Condividi tramite


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.

Comments

  • Anonymous
    October 13, 2007
    Nice post. I noticed that even when I disabled "PDB generation" by setting option "Generate Debug Info" to "No", VC80.pdb is generated. So, is VCx0.pdb ignoring those settings of generating debug info?? I read it at MSDN also, that VCx0.pdb contains the type information only, does it really contain any type information about our project or only the type information from Windows header files? Any idea, what will be the impact if I dont have PDB, vcx0.pdb but have my project.pdb?? Thanks.

  • Anonymous
    December 04, 2007
    If you are setting the option “Project->Project Properties->Configuration Properties->Linker->Debugging->Generate Debug Info” to "No", the linker will not generate <TARGET_NAME>.PDB files. For generating the vcx0.PDB files, there is an option in the "Project Properties->C/C++->output files->Program Database Filename", using this option you can specify the location of the VCx0.pdb files(or any other filename selected by you). Yes if you don't specify anything here then also this file will be created automatically by the compiler. If we want to debug an  application, we need the linker generated <TARGET_NAME>.PDB files and the compiler generated VCx0.PDB is not required.

  • Anonymous
    April 15, 2011
    I am also have the same problem. Now it is disabled thanks a lot.

  • Anonymous
    May 08, 2011
    I have a set of static libs that are consumed by a different team. when I send out the binaries to them (.lib and .dll files), I only package the <TargetName>.pdb for the .dll that I deliver. However, one of the teams that use the .lib file instead of the .dll file has come back complaining that they get a build warning "Debug info is missing, compiling as if no debug info provided". How do I sort out this issue? Should I be shipping the .pdb file that are generated as a part of "Project Properties > C/C++ > Output Files > Program Database File Name" for the static libs? As I understand it, the vcx0.pdb is only type information and this is per object file (does that mean if my project has 5 cpp files, the vcx0.pdb will be generated 5 times, once for each cpp), so what are my options?

  • Anonymous
    April 25, 2012
    I am facing this problem related to pdb file :- One 'X' vc++ dll project has dependency over other project 'Y' At the time of build, i'm getting following warning :- 'PDB VC90.pdb was not found with ... or at ..., linking object as if no debug info.' So what is the reason behind this warning ?