Visual Studio 2008: how to view disassembled code for a DLL that is not currently running

I am using Visual Studio 2008 to track runtime errors. I joined the process and identified the module of interest. (It happens that the debugging symbols for this module were loaded from the pdb file.) I want to show the disassembled code in the "Disassembly" window so that I can decide where to set the breakpoint.

When I interrupt the process, the current executable is displayed in the Disassemble window. Unfortunately, this is not a module of interest. I can’t figure out how to show the code of the module of interest until it runs.

+6
visual-studio disassembly
source share
3 answers

Assuming you are debugging an unmanaged process ...

When you are "Debug / Break All", follow these steps:

Select "Debug / Windows / Modules" to get a list of all loaded modules. The "Address" column in the "Modules" window shows the memory range for this module. In the "Address:" field in the disassembly window, enter the starting address of the module (be sure to add 0x in front of the number)

Now you should be at the beginning of the module you want to play with. If you know the address of the function, you can simply go to that address.

Here is an example:

Run sol.exe Attach to the process and break everything. Look at the modules and find "cards.dll", you will see that it loads on 6fc10000 (on my machine, anyway).

Enter this address (0x6fc10000) in the disassembly window, and it will lead you to the beginning of the module.

Now say that I want to go to the function. Open the DLL in Dependency Walker (depend.exe) to get the function offsets. In my example, I want to set a breakpoint on the cdInit function. Dependecny Walker shows that the offset to the exported cdInit function is 0x000013e6. Therefore, to go to this function, I would add the starting address of the module (0x6fc10000) to the offset (0x000013e6) to get 0x6fc113e6.

Entering this address in the disassembler field really takes me straight to the beginning of this function.

+5
source share

Performing such actions is much easier in WinDbg.

uf cards!cdInit 
+1
source share

Have you tried using the .Net reflector? You can get all the code from your DLL and maybe even recompile it with debugging messages. It's free:

http://www.red-gate.com/products/reflector/

Greetings

0
source share

All Articles