Share via


The .pdb Files

The .pdb (program database) file holds debugging and project state information. The .pdb file provides the information needed for incremental linking of debug program versions.

Although earlier, 16-bit versions of Visual C++ used .pdb files, the debugging information stored in them was appended to the end of the .exe or .DLL file by the linker. Now, with 32-bit .exe’s, both the linker and the integrated debugger allow .pdb files to be used directly during the debugging process, eliminating substantial amounts of work for the linker and bypassing the cumbersome CVPACK limit of 64K types.

By default, when you build projects generated by Visual C++, the compiler switch /Fd is used to rename the .pdb file to <project>.pdb. Therefore, you will have only one .pdb file for the entire project.

When you run makefiles that were not generated by Visual C++, and the /Fd is not used with /Zi, you will end up with two .pdb files:

  • VCx0.pdb (where x refers to the major version of the corresponding Visual C++). This file stores all debugging information for the individual .obj files and resides in the directory of the project makefile.

  • <project>.pdb   This file stores all debugging information for the resulting .exe file and resides in the \WINDEBUG subdirectory.

Why two files? When the compiler is run, it doesn't know the name of the .exe file into which the .obj files will be linked, so the compiler can't insert the information into <project>.pdb. The two files store different information. Each time you compile an .obj file, the compiler merges the debugging information into VCx0.pdb. It only inserts information concerning types and does not insert symbol information such as function definitions. One benefit of this is that when every source file includes common header files such as <windows.h>, all the typedefs from these headers are only stored once, rather than in every .obj file.

When you run the linker, it creates <project>.pdb, which holds the debugging information for the project's .exe file. All debugging information, including function prototypes and everything else, is placed into <project>.PDB, not just the type information found in VCx0.pdb. The two kinds of .PDB files share the same extension because they are architecturally similar and they both allow incremental updates. Nevertheless, they actually store different information.

The Visual C++ debugger uses the <project>.pdb file created by the linker directly, and embeds the absolute path to the .pdb in the .exe or .dll file. If the debugger can't find the .pdb file at that location or if the path is invalid (for example, if the project was moved to another computer), the debugger looks for it in the current directory.