joi, 16 februarie 2012

Get the Module / Assembly for a Method with Windbg

I have a bug, that it is telling that the application hangs. I have the dump for that hang.
How to tackle the problem:

  • use !threads to look for locks (in the results there is a column "Lock Count")
    • Results: there is no lock on any thread
  • Check the GUI/main thread:  !CLRStack
0:000> !CLRStack
Child SP IP       Call Site
0041de38 7598f5be [InlinedCallFrame: 0041de38] System.Windows.Forms.UnsafeNativeMethods.WaitMessage()
0041de34 6cf3737a System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
0041ded0 6cf36e2c System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
0041df28 6cf36c81 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
0041df58 6d42fefb System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)
0041df6c 6d459f83 System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
0041df70 6d45a1b7 [InlinedCallFrame: 0041df70] 
0041e008 6d45a1b7 System.Windows.Forms.Form.ShowDialog()
0041e00c 00be1b5f NS_DGFWKP_GUI.DGFWKP_GUI.CollectButton_Click(System.Object, System.EventArgs)
0041e074 6ced4ae8 System.Windows.Forms.Control.OnClick(System.EventArgs)
0041e08c 066c42ba DevExpress.XtraEditors.BaseButton.OnClick(System.EventArgs)
0041e09c 066c41b7 DevExpress.XtraEditors.BaseButton.OnMouseUp(System.Windows.Forms.MouseEventArgs)
0041e0d0 6d4395b5 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
0041e164 6d7fa1bf System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
0041e168 0fb17195 [InlinedCallFrame: 0041e168] 
  • So, it is about a modal dialog  that it is displayed in the back of the main window. Most probably. 
  • It should be used  ShowDialog Method (IWin32Window) method instead to avoid this issue.
  • Now the problem is who is  NS_DGFWKP_GUI .. intuitive name :)
  • Use !ip2md to find out more info about  NS_DGFWKP_GUI.DGFWKP_GUI.CollectButton_Click method
0:000> !ip2md 00be1b5f
MethodDesc:   1da5450c
Method Name:  NS_DGFWKP_GUI.DGFWKP_GUI.CollectButton_Click(System.Object, System.EventArgs)
Class:        1db037dc
MethodTable:  1da54620
mdToken:      06000047
Module:       1da53c70
IsJitted:     yes
CodeAddr:     00be1070
Transparency: Critical
  • Use  !dumpmodule to find out more info about the module
0:000> !dumpmodule -mt 1da53c70
Name:       C:\Program Files (x86)\Ixia\IxNetwork\\diaggui.dll
Attributes: PEFile 
Assembly:   11faf8a8
LoaderHeap:              00000000
TypeDefToMethodTableMap: 1db0199c
TypeRefToMethodTableMap: 1db01a24
MethodDefToDescMap:      1db01c60
FieldDefToDescMap:       1db01f3c
MemberRefToDescMap:      1db0206c
FileReferencesMap:       1db023fc
AssemblyReferencesMap:   1db02400
MetaData start address:  1e18d498 (26680 bytes)

Types defined in this module

      MT  TypeDef Name
1da56448 0x02000002 NS_DGFWKP_GUI.ChassisWindow
2a30b670 0x02000003 NS_DGFWKP_GUI.ChassisChain
2a30b754 0x02000004 NS_DGFWKP_GUI.Chassis

  • End "voila", I find the responsible module/package for this issue
  • It will be nice if these namespaces will have a meaningful name in the future.

Niciun comentariu:

Trimiteți un comentariu