Using Microsoft Program Database (PDB) Files

A program database (PDB) file holds debugging and project state information about a program and can be created in a number of ways. Historically, it has been created using a Microsoft compiler and written in C/C++, C#, and Visual Basic. A user generates a PDB file using the /ZI or /Zi flag (for C/C++ programs) or the /debug flag (for Visual Basic/C# programs).

There are two mechanisms for processing a PDB file. First, the platform-independent PDB Universal Reader/Analyzer, which can read a raw PDB file and apply it. Its capabilities are expected to be expanded in future releases. Second, the legacy capability that uses the DIA SDK to read information from the PDB file. This mechanism can only run on a Windows platform, however it creates an XML representation of information gleaned using the DIA SDK. These XML files can be saved and then used on Windows and non-Windows platforms hosting Ghidra.

If loading a PDB, this should be done prior to other analysis, except in special cases, such as when only loading data types.

Restricted loading of data types or public symbols is supported by PDB Universal.

To Load a PDB

PDB files can be loaded in two ways:

Information Loaded From PDB

  1. Structure and union definitions
  2. Typedefs
  3. Enumerations
  4. Class definitions
  5. Function prototypes
  6. Stack variable names and data types
  7. Source line numbers
  8. Instruction and data symbols

The DIA SDK-Based Capability

*.PDB.XML files can be created in three different ways:

NOTE: Execution of pdb.exe has runtime dependencies which must be satisfied. Please refer to the README_PDB document for details.

Debug Interface Access SDK

The Microsoft Debug Interface Access Software Development Kit (DIA SDK) provides access to debug information stored in program database (.PDB) files generated by Microsoft post-compiler tools. Because the format of the .PDB file generated by the post-compiler tools undergoes constant revision, exposing the format is impractical. Using the DIA API, you can develop applications that search for and browse debug information stored in a .PDB file. Such applications could, for example, report stack trace-back information and analyze performance data.

If you are attempting to load a PDB on a Windows machine and see an error message such as "Unable to locate the DIA SDK," you will need to add and register one or more files on your computer. Refer to the README_PDB document for detailed instructions.

Related Topics: