Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PDB (Program Database)/DBI stream

From ReverseEngineering.wiki

Stream 3 of a Microsoft PDB: a 64-byte header with the numbers of the symbol streams, the toolset version and the sizes of seven substreams, then the module list (one 64-byte record + module and object names per object file or import library), section contributions, section map, file info, type server map, EC info and the optional debug header with the stream numbers of FPO, section header, xdata/pdata and OMAP data.

Header

NewDBIHdr (PDB/dbi/dbi.h), 64 bytes, little endian:

Offset Size Field
0x00 4 verSignature = -1 (FF FF FF FF)
0x04 4 verHdr = 19990903 (DBIImpvV70) in every file; V41 930803, V50 19960307, V60 19970606, V110 20091201 also defined
0x08 4 age (see Format:PDB (Program Database)#Matching a PDB to an executable)
0x0C 2 stream number of the global symbols hash (snGSSyms)
0x0E 2 mspdb version: bit 15 set = new format, bits 8-14 major, bits 0-7 minor
0x10 2 stream number of the public symbols hash (snPSSyms)
0x12 2 mspdb build number
0x14 2 stream number of the symbol records (snSymRecs)
0x16 2 mspdb rebuild (QFE) number
0x18 4 module info size (cbGpModi)
0x1C 4 section contribution size (cbSC)
0x20 4 section map size
0x24 4 file info size
0x28 4 type server map size
0x2C 4 index of the MFC type server (iMFC)
0x30 4 optional debug header size (cbDbgHdr)
0x34 4 EC info size (cbECInfo)
0x38 2 flags: bit 0 incrementally linked, bit 1 stripped, bit 2 CTypes
0x3A 2 machine (IMAGE_FILE_MACHINE_*: 0x8664 x64, 0x14C x86, 0xAA64 ARM64)
0x3C 4 reserved

The version fields give the linker's toolset: the files checked showed 14.00.23615, 14.00.24210, 14.38.33133, 14.38.33140, 14.38.33145, 14.44.35216 and 14.51.36252 (build and QFE in the fields at 0x12 and 0x16). The stream size is exactly 64 + the seven substream sizes (dbi.cpp checks it). Fact:PDB (Program Database)/struct/DBI stream header

Substream order

After the header, in this order: module info, section contributions, section map, file info, type server map, EC info, optional debug header (dbi.cpp reads them at lines 378-696). The last two are stored in the opposite order of their size fields. Fact:PDB (Program Database)/behavior/DBI substream order

The EC info substream is a serialised name table (nmtEC.reload, dbi.cpp 660-677) in the same format as the /names stream: uint32 0xEFFEEFFE; uint32 version 1; uint32 cbStrings; strings; uint32 bucketCount; uint32 buckets[]; uint32 nameCount. An empty table is 25 bytes (the 1-byte string buffer holds only the leading NUL), the cbECInfo of most files checked, so even a stripped PDB without /names contains the bytes FE EF FE EF inside its DBI stream.

Module info

One record per contributing object file, import library member or linker-generated module (MODI_60_Persist), 4-byte aligned:

Offset Size Field
0x00 4 unused (in-memory Mod pointer)
0x04 28 first section contribution (SC: section, offset, size, characteristics, module index, data CRC, reloc CRC)
0x20 2 flags (bit 0 written, bit 1 EC enabled, bits 8-15 type server index)
0x22 2 module stream number, 0xFFFF if none
0x24 4 symbol bytes in the module stream (including the 4-byte CodeView signature)
0x28 4 C11 line bytes (0 in current files)
0x2C 4 C13 line bytes
0x30 2 number of source files
0x34 4 unused (in-memory file name offsets)
0x38 8 EC info: source file and compiler PDB name indexes
0x40 module name, NUL; object or library name, NUL; pad to 4

Import library members appear as a module named after the DLL (KERNEL32.dll) with the import library's path as object name; CRT objects as their full build path inside the CRT library. Names are build paths of the machine that linked, so they reveal directory layouts and toolchain versions. Fact:PDB (Program Database)/struct/DBI module info record

Section contributions

A uint32 version, then fixed-size entries: 0xEFFE0000 + 19970605 (V60, 28-byte SC entries) in every file checked, or 0xEFFE0000 + 20140516 (V2, 32-byte entries with an extra COFF section index). Fact:PDB (Program Database)/enum/Section contribution versions

Optional debug header

An array of uint16 stream numbers (0xFFFF = absent) indexed by DBGTYPE: 0 FPO, 1 exception (deprecated), 2 fixup, 3 OMAP to source, 4 OMAP from source, 5 section headers (an array of 40-byte IMAGE_SECTION_HEADERs of the image), 6 token/RID map, 7 xdata, 8 pdata, 9 new FPO, 10 original section headers. 11 entries (22 bytes) are defined; 54 of the 57 files checked had 24 bytes (a 12th entry, 0xFFFF), 3 had 22. Section headers were present in all 57 files; FPO + new FPO in 5 of the 7 x86 files; the other 2 x86 files (kernel drivers, by their fixup stream) had fixup, new FPO, xdata and pdata streams. Fact:PDB (Program Database)/enum/Optional debug stream indexes

Evidence & references

  • microsoft/microsoft-pdb at commit 805655a28bd8198004be2ac27e6e0290121a5e89: PDB/dbi/dbi.h 11-15 (SC versions), 114-122 (DBI versions), 124-196 (header), 1162-1192 (MODI_60_Persist); PDB/dbi/dbi.cpp 351-356 (size check) and 378-696 (substream order); PDB/include/dbicommon.h 19-46 (SC); langapi/include/pdb.h 438-451 (DBGTYPE).
  • Runtime test: Code:PDB (Program Database)/pdbinfo (Python) on the 58 PDBs described on Format:PDB (Program Database).