且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IL级代码调试器

更新时间:2023-09-18 23:41:16

如果实际上没有源代码调试IL是有用的, >***的方法是使用ILDASM来反汇编托管二进制,这将生成IL指令。然后使用ILASM重新编译IL源代码,当您启动Visual Studio调试器时,您将能够逐步了解原始IL。


  1. ildasm foo.exe /OUT=foo.exe.il / SOURCE

  2. ilasm foo.exe.il / DEBUG

我已经写了一篇有关此主题的博客文章:
如何调试编译器生成的代码


Is there any IL level debugger in form of a VS plugin or standalone application?

Visual studio’s debugger is great, but it allows you to debug on either HLL code level or assembly language, you can’t debug IL. It seems that in some situations it would be useful to have an opportunity to debug at IL level.

In particular it might be helpful when debugging a problem in the code that you don't have the source of.

It is arguable if it is actually useful to debug IL when you don't have the source, but anyway.

The best way to do this is to use ILDASM to disassemble the managed binary, which will generate the IL instructions. Then recompile that IL source code using ILASM, when you fire up the Visual Studio debugger you will be able to step through the raw IL.

  1. ildasm foo.exe /OUT=foo.exe.il /SOURCE
  2. ilasm foo.exe.il /DEBUG

I've written a blog post about this topic at: How to debug Compiler Generated code.