Log in

View Full Version : Debugging a .NET application


Balam
February 18th, 2003, 16:14
I would like to reverse a .NET application.

I can disassemble it in IDA, of course, but I would like to trace it "step by step", place breakpoints, etc.

Would anyone be kind enough to provide me with the appropriate information ?

Kayaker
February 18th, 2003, 16:48
Is the info 10 posts down helpful?

zacdac
February 18th, 2003, 21:05
What you are really after is a MSIL (microsoft intermediate language) debugger.

There is one that is supplied with the .Net Framework SDK.
However there are several steps you need to perform first to enable debugging of IL code.

Remember this process is designed to debug your own source code. You can reverse code that you do not have the source for as long as you get around the strong named assembly first.

To debug IL code..
1) Produce an IL code listing using ildasm (dump the IL code to file). ildasm is usually found in the following dir
C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\

2) Produce a debug information file (*.pdb) using ilasm by passing it the name of the *.il file you produced above and supplying the /debug switch. Note this will recompile the assembly (note the assembly may not run if it was intended to be a strong named assembly).

Ilasm is usually in the following directory
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\

3) Use DBGCLR.exe which is found in the following directory
C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\GuiDebug

When you run this debugger, you need to open the *.IL file produced in step 1 above.
Then you need to specify the program to run (the executable) and the working directory (menu debug-> Program to debug)

phew.. Now you are ready to debug the assembly. You can set breakpoints on IL instructions and view variables etc.

There are more tricks to learn, but that will get you started.

ZD

Balam
February 19th, 2003, 14:51
Thank you very much, this is exactly what I was looking for !