Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I debug a compiled assembly?

I am looking for a way to debug compiled assemblies from Visual Studio.

Is it possible? Maybe using some kind of reflector add-in?

I am not looking for a way to decompile/recompile and then debug.

like image 701
tom greene Avatar asked Feb 17 '10 22:02

tom greene


People also ask

Can you debug assembly?

The debugger automatically displays the contents of memory locations and registers as they are accessed and displays the address of the program counter. This display makes assembly debugging a valuable tool that you can use together with source debugging.

How do I debug a compiled code in Visual Studio?

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.

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 show assembly code in Visual Studio?

You can normally see assembly code while debugging C++ in visual studio (and eclipse too). For this in Visual Studio put a breakpoint on code in question and when debugger hits it rigth click and find "Go To Assembly" ( or press CTRL+ALT+D )


2 Answers

If you don't have the PDB files for the assembly, try using .Net Reflector Pro, which was released a few days ago. It can decompile the code on-the-fly in Visual Studio and then step through it as if you were debugging your own source code (it does not require you to decompile and then recompile again). It is a paid for Visual Studio addin, but comes with a 14 day trial, after which it reverts back to the free version of Reflector.

like image 163
adrianbanks Avatar answered Oct 20 '22 03:10

adrianbanks


Yes. You can accomplish this is to disable the "Just My code" feature (Tools -> Options -> Debugging) and then load the PDB for the DLL. After that you will be able to step into the DLL without any issue.

like image 20
JaredPar Avatar answered Oct 20 '22 03:10

JaredPar