Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IL level code debugger

Tags:

.net

debugging

il

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.

like image 271
axk Avatar asked Aug 12 '08 20:08

axk


People also ask

How do you debug a deployed code?

To use Visual Studio to debug a deployed application, you must attach to the ASP.NET worker process and make sure that the debugger has access to symbols for the application. You must also locate and open the source files for the application. For more information, see Specify Symbol (.

How do I debug IIS in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug, and either IIS Express, or the new IIS profile name, appears in the emulator field. To start debugging, select IIS Express or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.

How do you debug disassembly?

To enable the Disassembly window, under Tools > Options > Debugging, select Enable address-level debugging. To open the Disassembly window during debugging, select Windows > Disassembly or press Alt+8.

How do I decompile a DLL in Visual Studio code?

To do this, go to the Modules window and from the context menu of a . NET assembly, and then select the Decompile source code command. Visual Studio generates a symbol file for the assembly and then embeds the source into the symbol file. In a later step, you can extract the embedded source code.


1 Answers

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 in debug mode 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.

like image 85
Chris Smith Avatar answered Oct 01 '22 02:10

Chris Smith