PDB Files - What are they and how to generate them.

How to generate PDB files for RELEASE build

====================================

We can genererate PDB(Program Data Base) files for RELEASE build also.

Set “Project->Project Properties->Configuration Properties->Linker->Debugging->Generate Debug Info” to “Yes”.

Once you select this option, the next option “Generate Program Database File” will show the default path and name for the PDB file. If you build your solution it will generate <Targetname>.PDB file. This file will contain the debug info for the binary.

 

For generating the PDB in C#

=======================

Set “Project Properties -> Build -> Advanced…->Output -> Debug Info” to “PDB-only” or “Full”.

 

What are the two types of .PDB files?

==============================

There are two types of PDB files. One generated by the compiler named as VCx0.PDB(e.g. vc80.pdb), and another the <Targetname>.PDB.

 

The VCx0.PDB file is generated by the compiler and it is related to the .OBJ file. It contains the type information only.

 

The <Targetname>.PDB files are generated by the linker and it is related with the target executable or the DLL. This file contains the complete debug info. When we are debugging, we need this ‘.pdb’ file for aligning to the symbols. The timestamp of the target file and the PDB should match.