如果要在调试时转储IL,可以使用!dumpilSOS中的命令.它需要一个MethodDesc指针作为输入,因此您必须先获取它.
获取MethodDesc指针的一种方法是使用该!name2ee命令.
因此,例如,如果您Foo在类型Bar(在汇编中ClassLibrary1)中有一个方法,请使用!name2ee这样的方法
0:000> !name2ee ClassLibrary1!ClassLibrary1.Bar.Foo
Module: 001630bc (ClassLibrary1.dll)
Token: 0x06000001
MethodDesc: 00163450 <=== HERE
Name: ClassLibrary1.Bar.Foo()
JITTED Code Address: 007500f0
Run Code Online (Sandbox Code Playgroud)
接下来,您可以执行一个!dumpil 00163450转储IL的方法,Foo就像这样
0:000> !dumpil 00163450
ilAddr = 73532050
IL_0000: ldstr "Foo"
IL_0005: call System.Console::WriteLine
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1935 次 |
| 最近记录: |