.PDB
Microsoft program database
Introduction
A .pdb file holds the debug information for a Windows program or library:
the names and types of its functions and variables and the source line for each piece of
code. The Microsoft linker writes it beside the PE
file, and the program records the PDB’s name and a matching GUID, so a debugger can find
the right one, even on a symbol server.
The extension has other uses. Chemistry software uses .pdb for Protein
Data Bank structures, which are text files, and Palm OS used it for its databases.
Software
Structure
A modern PDB file is a small file system called MSF (multi-stream format). The file is
divided into fixed-size blocks, usually 4096 bytes. The first block is the superblock:
the 32-byte magic Microsoft C/C++ MSF 7.00\r\n\x1ADS\0\0\0, then the block
size, the number of blocks and the location of the stream directory. The directory lists
the streams in the file and which blocks each one occupies, so a stream’s blocks need
not be next to each other.
The streams are numbered. Stream 1 holds the PDB’s version, age and GUID; stream 2 the type information; stream 3 the debug information about each compiled module and its source lines; stream 4 the IDs of functions and other items. Further streams are found by name or through the debug information stream.
0superblock: magic, block size, block counts, directory locationblock 0…free block mapsblocks 1 and 2…stream directory: stream sizes and their block numbersvaries…streams: PDB info, types, debug info, IDs, symbols, namesvaries