gpt4 book ai didi

c# - 从 windbg 的 clrstack 输出中获取对象详细信息

转载 作者:太空宇宙 更新时间:2023-11-03 14:04:11 25 4
gpt4 key购买 nike

我有一个多线程 .NET 应用程序卡在 OnUserPreferenceChanged 事件上。这通常是由在后台线程上启动的 UI 控件或消息循环引起的(参见例如 http://www.ikriv.com/en/prog/info/dotnet/MysteriousHang.html ),但据我所知,这里并非如此。我通过在 WindowsFormsSynchronizationContext 中设置断点(如此处建议的 http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/ )验证了这一点,它只在主 UI 线程中构造一次。

这是 windbg 中 !clrstack 的输出:

0013eea8 7c90e514 [HelperMethodFrame_1OBJ: 0013eea8] System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32, Boolean, Boolean) 0013ef54 792b68af System.Threading.WaitHandle.WaitOne(Int64, Boolean) 0013ef70 792b6865 System.Threading.WaitHandle.WaitOne(Int32, Boolean) 0013ef84 7b6f1a4f System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle) 0013ef98 7ba2d68b System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean) 0013f038 7b6f33ac System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[]) 0013f06c 7b920bd7 System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object) 0013f084 7a92ed62 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[]) 0013f0b8 7a92dc8f Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[]) 0013f104 7a92e227 Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr, IntPtr) 0013f124 7aaa06ec Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr)

我可以获得参数信息的最后一种方法是:

0013f084 7a92ed62 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[]) PARAMETERS: this = 0x01404420 checkFinalization = 0x00000001 args = 0x0144a298

这是我的问题:我怎样才能在这里获得更多信息?最后,我想知道此 Invoke 适用于哪些对象和/或线程。类似于“!do 0x01404420”或“!do 0x0144a298”之类的东西,但我不知道从那里去哪里。

最佳答案

使用 !dumpheap -type Exception 在堆中搜索异常。

您还可以看到类中变量的值,这对于了解类的状态很有用。使用 !dumpheap -type 类名。您将获得一个 MT(方法表)地址。从 MT 地址看到对象地址。使用 !do 地址转储类。

使用!syncblk查看锁定的线程

关于c# - 从 windbg 的 clrstack 输出中获取对象详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9910943/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com