检查/反汇编 .Net 本机映像

发布于 2024-12-01 12:49:41 字数 860 浏览 1 评论 0 原文

是否可以反汇编/检查 .Net JITer / ngen 生成的本机代码? (纯粹出于学术目的)

试图回答这个问题 我对 JITer 会执行什么样的优化很感兴趣 - 而不是疯狂地推测,我真的很希望能够亲眼看看到底发生了什么。

到目前为止,我已经:

  1. 使用 ngen(这个输出可能与 JIT 编译器的输出不同吗?)
  2. 从 GAC 中复制了本机映像

,但现在我有点卡住了 - 因为据我所知,.Net 程序集采用 可移植可执行文件 格式,但是普通工具我可能会使用反汇编这样一个文件(objdump)只是 barf:

C:\Users\justin\Desktop>objdump -d ConsoleApplication1.ni.exe
objdump: ConsoleApplication1.ni.exe: File format not recognized

以这种方式查看本机图像是否可行?如果做不到这一点,是否有其他方法可以满足我的好奇心? (例如反汇编正在运行的进程中的代码)

Is it possible to disassemble / inspect the native code produced by the .Net JITer / ngen? (for purely academic purposes)

In attempting to answer this question I became intrigued about what sort of optimisations the JITer would perform - rather than speculate wildly I'd really like to be able to see for myself what is really hapenning.

So far I've:

  1. Installed a native image of my candidate assembly using ngen (is the output of this potentially different from the output of the JIT compiler?)
  2. Copied the native image out of the GAC

But now I'm a bit stuck - as far as I was aware .Net assemblies are in the portable execuable format, but the normal tools that I might use to disassemble such a file (objdump) just barf:

C:\Users\justin\Desktop>objdump -d ConsoleApplication1.ni.exe
objdump: ConsoleApplication1.ni.exe: File format not recognized

Is it feasible to peek inside a native image in this way? Failing that is there some alternative way that I might be able to satisfy my curiosity? (for example disassembling the code in a running process)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她说她爱他 2024-12-08 12:49:41

I've had some success with windbg and dumpbin in the past, when trying this sort of thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文