diassemble管理code问题 [英] diassemble managed code issue

查看:334
本文介绍了diassemble管理code问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Windbg使用的Windbg的!U 命令从sos.dll至diassemble管理code(C#编写,控制台应用程序)。我发现当使用!U 来diassemble有管理的功能,diassembled IL code仅包含函数调用我做了,而对于其余部分(非函数调用C#code),例如 A = A * 2 的foreach 循环在C#中,唯一的本地汇编语言$ C是表示C $,是正确的预期行为?

I am using Windbg to diassemble managed code (written in C#, console application) using Windbg's !U command from sos.dll. I find when using !U to diassemble a managed function, the diassembled IL code only contains function calls I made, and for remaining parts (non-function call C# code), for example a=a*2, and foreach loops in C#, only native assembly language code is shown, is that the correct expected behavior?

我的问题是,我想知道是否ü!能够diassemble管理code二进制DLL到IL所有code(除了函数调用code)?

My question is, I want to know whether !U is capable of diassemble managed code binary DLL into IL with all code (besides function call code)?

在此先感谢, 乔治

推荐答案

如果你想甩IL调试时,您可以使用!dumpil 从SOS命令。它需要一个方法描述指针作为输入,所以你必须获取第一。

If you want to dump IL while debugging you can use the !dumpil command from SOS. It takes a MethodDesc pointer as input, so you have to obtain that first.

获得方法描述指针使用的一种方式!name2ee 命令。

One way to get the MethodDesc pointer use the !name2ee command.

因此​​,举例来说,如果你有的类型酒吧(以组件的方法 ClassLibrary1的)使用!name2ee 像这样

So for instance if you have a method Foo in the type Bar (in assembly ClassLibrary1) use !name2ee like this

0:000> !name2ee ClassLibrary1!ClassLibrary1.Bar.Foo
Module: 001630bc (ClassLibrary1.dll)
Token: 0x06000001
MethodDesc: 00163450  <=== HERE
Name: ClassLibrary1.Bar.Foo()
JITTED Code Address: 007500f0

在此之后,你可以做一个!dumpil 00163450 转储IL的方法像这样

Following that, you can do a !dumpil 00163450 to dump the IL for method Foo like this

0:000> !dumpil 00163450
ilAddr = 73532050
IL_0000: ldstr "Foo"
IL_0005: call System.Console::WriteLine

这篇关于diassemble管理code问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆