ILSpy Debugger Preview

In this blog post I'd like to present a new feature of ILSpy decompiler: the integrated debugger. You can download it from

http://sourceforge.net/projects/sharpdevelop/files/ILSpy/1.0/ILSpy-Debugger-Preview.zip/download

Please note that the ILSpy base functionality is similar to the soon-to-be-released M2 build. However, only use it if you want to test the debugger - if you are only interested in decompilation continue using the standard builds. The update check in this preview does not work, please disregard the request to update.

The debugger engine - Debugger.Core.dll - is basically the same as the one in SharpDevelop IDE - some modifications were made in order to use the latest version of NRefactory. The library that handles the UI stuff (like breakpoints, tooltips, attach to process window) - ILSpy.Debugger.dll - is based on SharpDevelop Debugger.Addin library.

When opening ILSpy, a new menu item is available: Debugger. Under this menu, you will find the following menu-items:

  • Debug an executable - you will be asked to point to an .NET executable that ILSpy will start debugging
  • Attach to a running application - you will be asked to point to a running .NET executable that ILSpy will debug
  • Continue debugging (F5) - will continue the execution of the process
  • Step into (F11) - will step into the code
  • Step over (F10) - will step over the code
  • Steo out (F11) - will step out the code
  • Detach from running application - will detach the debugger
  • Remove all breakpoints - will remove all breakpoints
Also, when decompiling a whole type, a margin appears on the left side of editor where breakpoints can be set (just like in SharpDevelop IDE). Setting breakpoints and debugging a single method/property will be implemented in future versions of this feature.
To debug a .NET application, one can use two different options:
  • Debug an executable
  • Attach to running application
The main difference of these two (from debugging experience point of view) is that when attaching to a running application that was optimized, the evaluation will not work. Therefore, we recomand to use the Debug an executable option. Using the last option, the evaluation will work for any kind of application.
When debugger is attached and a breakpoint is hit, the same common operations are available: continue, step into, step over, step over and evaluate something. Also, the status is shown in the status bar: Stand by, Running and Debugging.
Beside debugging in C# code, debugging in IL is also supported and breakpoints/current line mark are synchronized.
What is great about the debugger (beside it's existence in ILSpy :) ) is the fact that no PDB files are generated. The IL-C# code-mappings are determined on-demand and used to update the user interface.
TODO list:
  • set breakpoints in single methods/properties - this is top priority
  • mixed code (C# - IL) debugging - idea of David
  • drag and drop current line marker
  • others - community wishes :)
Known issues:
  • debugging ASP.NET applications and web services is not working (yet)
If you find any issues on this feature, please let us now in our forum or in our github issues page.
Have fun debugging the decompiled code! :)
Published Tuesday, April 12, 2011 9:48 PM by Eusebiu
Filed under: ,

Comments

# re: ILSpy Debugger Preview

Just awesome ...

Saturday, May 07, 2011 8:48 AM by Anindya Chatterjee

# re: ILSpy Debugger Preview

Glad you like it! There's more to come! :)

Saturday, May 07, 2011 9:23 AM by Eusebiu

# re: ILSpy Debugger Preview

This is very useful feature. Thanx a lot!

But, it will be nice to support evaluation when use attach to process. Because now is not possible to use normal debugging (with evaluation) for Windows Services.

Wednesday, June 01, 2011 4:26 PM by victor.hytyk

# re: ILSpy Debugger Preview

The evaluation should work even when attaching to process. The evaluation does not work when the code is optimized.

Wednesday, June 01, 2011 6:29 PM by Eusebiu

# re: ILSpy Debugger Preview

Hello,

I posted a message earlier, because I tested latest nightly build and the downloaded binary ilspy.exe not shows debugging functions under the x64 win7 platforms.

I downloaded the source and rebuild "ILSpy version 2.0.0.1219" with x86 plateform (not any cpu).

And now the debugging functions are available under x64 win7.

Regards

Saturday, June 25, 2011 4:56 PM by endmarsfr