Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the PDB get me while debugging and how do I know it's working?

I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects.

CorpObject o = new CorpObject();
Int32 result = o.DoSomethingLousy();

While debugging, the method 'DoSomethingLousy' throws an exception. What does the PDB file do for me? If it does something nice, how can I be sure I'm making use of it?

like image 246
Anthony Mastrean Avatar asked Sep 09 '08 18:09

Anthony Mastrean


People also ask

How do I use pdb debugging?

The easiest way to use the PDB file is to let Visual Studio do the heavy lifting - either launch your program with Visual Studio's "Debug" command (F5 by default), or run the program and use the "Attach to Process" item in Visual Studio's Debug menu.

How we can detect and correct the error in program using pdb debugger?

To start debugging within the program just insert import pdb, pdb. set_trace() commands. Run your script normally and execution will stop where we have introduced a breakpoint. So basically we are hard coding a breakpoint on a line below where we call set_trace().

How does a pdb work?

A PDB file is typically created from source files during compilation. It stores a list of all symbols in a module with their addresses and possibly the name of the file and the line on which the symbol was declared. This symbol information is not stored in the module itself, because it takes up a lot of space.

What are PDBS where must they be located for debugging to work?

pdb file stores all debug information for the project's .exe file, and resides in the \debug subdirectory.


1 Answers

To confirm if you're using the provided PDB, CorporateComponent.pdb, during debugging within the Visual Studio IDE review the output window and locate the line indicating that the CorporateComponent.dll is loaded and followed by the string Symbols loaded.

To illustrate from a project of mine:

The thread 0x6a0 has exited with code 0 (0x0).
The thread 0x1f78 has exited with code 0 (0x0).
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug  \AvayaConfigurationService.exe', Symbols loaded.
'AvayaConfigurationService.vshost.exe' (Managed): Loaded 'C:\Development\Src\trunk\ntity\AvayaConfigurationService\AvayaConfigurationService\bin\Debug\IPOConfigService.dll', No symbols loaded.

Loaded 'C:\Development\src...\bin\Debug\AvayaConfigurationService.exe', Symbols loaded.

This indicates that the PDB was found and loaded by the IDE debugger.

As indicated by others When examining stack frames within your application you should be able to see the symbols from the CorporateComponent.pdb. If you don't then perhaps the third-party did not include symbol information in the release PDB build.

like image 195
Henk Avatar answered Oct 13 '22 20:10

Henk