NetInverse Developers Blog

April 9, 2009
Category: Debugging — Tags: , , , , — admin @ 9:58 am

Command: !U

!U [-gcinfo] [-ehinfo] <MethodDesc address> | <Code address>

Presents an annotated disassembly of a managed method when given a MethodDesc pointer for the method, or a code address within the method body. Unlike the debugger “U” function, the entire method from start to finish is printed, with annotations that convert metadata tokens to names.

If you pass the -gcinfo flag, you’ll get inline display of the GCInfo for the method. You can also obtain this information with the !GCInfo command. If you pass the -ehinfo flag, you’ll get inline display of exception info for the method. (Beginning and end of try/finally/catch handlers, etc.). You can also obtain this information with the !EHInfo command.

IsJitted: yes,means it has been compiled; and you can use !U to inspect the native code.

Example output:

!clrstack
OS Thread Id: 0x36c (876)
ESP       EIP
0012f3c0 00ff019a IEnumerableTest.Utils.EnumToArray[[IEnumerableTest.Program+RoleType, LinqSelectTest]]()
0012f424 00ff00b9 IEnumerableTest.Program.Main(System.String[])
0012f69c 79e71b4c [GCFrame: 0012f69c] 

!ip2md 00ff019a
MethodDesc: 00933198
Method Name: IEnumerableTest.Utils.EnumToArray[[IEnumerableTest.Program+RoleType, LinqSelectTest]]()
Class: 0093140c
MethodTable: 0093313c
mdToken: 06000001
Module: 00932c5c
IsJitted: yes
CodeAddr: 00ff0160

!u 00933198
Normal JIT generated code
IEnumerableTest.Utils.EnumToArray[[IEnumerableTest.Program+RoleType, LinqSelectTest]]()
Begin 00ff0160, size e3
00FF0160 55               push        ebp
00FF0161 8BEC             mov         ebp,esp
00FF0163 57               push        edi
00FF0164 56               push        esi
00FF0165 53               push        ebx
00FF0166 83EC50           sub         esp,50h
00FF0169 8D7DC8           lea         edi,[ebp-38h]
00FF016C B90B000000       mov         ecx,0Bh
00FF0171 33C0             xor         eax,eax
00FF0173 F3AB             rep stos    dword ptr es:[edi]
00FF0175 33C0             xor         eax,eax
00FF0177 8945E4           mov         dword ptr [ebp-1Ch],eax
00FF017A 833D142E930000   cmp         dword ptr ds:[00932E14h],0
00FF0181 7405             je          00FF0188
00FF0183 E8C1A50D79       call        7A0CA749 (JitHelp: CORINFO_HELP_DBG_IS_JUST_MY_CODE)
00FF0188 33D2             xor         edx,edx
00FF018A 8955C4           mov         dword ptr [ebp-3Ch],edx
00FF018D 33D2             xor         edx,edx
00FF018F 8955C0           mov         dword ptr [ebp-40h],edx
00FF0192 C745BC00000000   mov         dword ptr [ebp-44h],0
00FF0199 90               nop
00FF019A B96C309300       mov         ecx,93306Ch (MT: IEnumerableTest.Program+RoleType)
00FF019F E816D9E878       call        79E7DABA (System.Type.GetTypeFromHandle(System.RuntimeTypeHandle), mdToken: 06000d56)
00FF01A4 8945B8           mov         dword ptr [ebp-48h],eax
00FF01A7 8B45B8           mov         eax,dword ptr [ebp-48h]
00FF01AA 8945C4           mov         dword ptr [ebp-3Ch],eax
00FF01AD 8B4DC4           mov         ecx,dword ptr [ebp-3Ch]
00FF01B0 8B01             mov         eax,dword ptr [ecx]
00FF01B2 FF90C8000000     call        dword ptr [eax+000000C8h]
00FF01B8 8945B4           mov         dword ptr [ebp-4Ch],eax
00FF01BB B9E8063379       mov         ecx,793306E8h (MT: System.Enum)
00FF01C0 E8F5D8E878       call        79E7DABA (System.Type.GetTypeFromHandle(System.RuntimeTypeHandle), mdToken: 06000d56)
00FF01C5 8945B0           mov         dword ptr [ebp-50h],eax
00FF01C8 8B45B4           mov         eax,dword ptr [ebp-4Ch]
00FF01CB 3B45B0           cmp         eax,dword ptr [ebp-50h]
00FF01CE 0F94C0           sete        al
00FF01D1 0FB6C0           movzx       eax,al
00FF01D4 8945BC           mov         dword ptr [ebp-44h],eax
00FF01D7 837DBC00         cmp         dword ptr [ebp-44h],0
00FF01DB 752F             jne         00FF020C
00FF01DD 90               nop
00FF01DE B96C723179       mov         ecx,7931726Ch (MT: System.ArgumentException)
00FF01E3 E8341E93FF       call        0092201C (JitHelp: CORINFO_HELP_NEWSFAST)
00FF01E8 8945A4           mov         dword ptr [ebp-5Ch],eax
00FF01EB BA5C2C9300       mov         edx,932C5Ch
00FF01F0 B901000070       mov         ecx,70000001h
00FF01F5 E80045FC78       call        79FB46FA (JitHelp: CORINFO_HELP_STRCNS)
00FF01FA 8BD0             mov         edx,eax
00FF01FC 8B4DA4           mov         ecx,dword ptr [ebp-5Ch]
00FF01FF E82C882B78       call        792A8A30 (System.ArgumentException..ctor(System.String), mdToken: 0600063b)
00FF0204 8B4DA4           mov         ecx,dword ptr [ebp-5Ch]
00FF0207 E82346FC78       call        79FB482F (JitHelp: CORINFO_HELP_THROW)
00FF020C 8B4DC4           mov         ecx,dword ptr [ebp-3Ch]
00FF020F E85C8A2878       call        79278C70 (System.Enum.GetValues(System.Type), mdToken: 0600010b)
00FF0214 8945AC           mov         dword ptr [ebp-54h],eax
00FF0217 8B55AC           mov         edx,dword ptr [ebp-54h]
00FF021A B99C419300       mov         ecx,93419Ch (MT: System.Collections.Generic.IEnumerable`1[[IEnumerableTest.Program+RoleType, LinqSelectTest]])
00FF021F E8CC2CE878       call        79E72EF0 (JitHelp: CORINFO_HELP_ISINSTANCEOFINTERFACE)
00FF0224 8BC8             mov         ecx,eax
00FF0226 FF1518429300     call        dword ptr ds:[00934218h] (System.Linq.Enumerable.ToArray[[IEnumerableTest.Program+RoleType, LinqSelectTest]](System.Collections.Generic.IEnumerable`1), mdToken: 06000574)
00FF022C 8945A8           mov         dword ptr [ebp-58h],eax
00FF022F 8B45A8           mov         eax,dword ptr [ebp-58h]
00FF0232 8945C0           mov         dword ptr [ebp-40h],eax
00FF0235 90               nop
00FF0236 EB00             jmp         00FF0238
00FF0238 8B45C0           mov         eax,dword ptr [ebp-40h]
00FF023B 8D65F4           lea         esp,[ebp-0Ch]
00FF023E 5B               pop         ebx
00FF023F 5E               pop         esi
00FF0240 5F               pop         edi
00FF0241 5D               pop         ebp
00FF0242 C3               ret

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

©2009 NetInverse. All rights reserved. Powered by WordPress