llvm-pdbutil.rst 14.3 KB

llvm-pdbutil - PDB File forensics and diagnostics

Synopsis

:program:`llvm-pdbutil` [subcommand] [options]

Description

Display types, symbols, CodeView records, and other information from a PDB file, as well as manipulate and create PDB files. :program:`llvm-pdbutil` is normally used by FileCheck-based tests to test LLVM's PDB reading and writing functionality, but can also be used for general PDB file investigation and forensics, or as a replacement for cvdump.

Subcommands

:program:`llvm-pdbutil` is separated into several subcommands each tailored to a different purpose. A brief summary of each command follows, with more detail in the sections that follow.

  • :ref:`pretty_subcommand` - Dump symbol and type information in a format that tries to look as much like the original source code as possible.
  • :ref:`dump_subcommand` - Dump low level types and structures from the PDB file, including CodeView records, hash tables, PDB streams, etc.
  • :ref:`bytes_subcommand` - Dump data from the PDB file's streams, records, types, symbols, etc as raw bytes.
  • :ref:`yaml2pdb_subcommand` - Given a yaml description of a PDB file, produce a valid PDB file that matches that description.
  • :ref:`pdb2yaml_subcommand` - For a given PDB file, produce a YAML description of some or all of the file in a way that the PDB can be reconstructed.
  • :ref:`merge_subcommand` - Given two PDBs, produce a third PDB that is the result of merging the two input PDBs.

pretty

Important

The pretty subcommand is built on the Windows DIA SDK, and as such is not supported on non-Windows platforms.

USAGE: :program:`llvm-pdbutil` pretty [options] <input PDB file>

Summary

The pretty subcommand displays a very high level representation of your program's debug info. Since it is built on the Windows DIA SDK which is the standard API that Windows tools and debuggers query debug information, it presents a more authoritative view of how a debugger is going to interpret your debug information than a mode which displays low-level CodeView records.

Options

Filtering and Sorting Options

Note

exclude filters take priority over include filters. So if a filter matches both an include and an exclude rule, then it is excluded.

Symbol Type Options
Other Options

dump

USAGE: :program:`llvm-pdbutil` dump [options] <input PDB file>

Summary

The dump subcommand displays low level information about the structure of a PDB file. It is used heavily by LLVM's testing infrastructure, but can also be used for PDB forensics. It serves a role similar to that of Microsoft's cvdump tool.

Note

The dump subcommand exposes internal details of the file format. As such, the reader should be familiar with :doc:`/PDB/index` before using this command.

Options

MSF Container Options
Module & File Options
Symbol Options
Type Record Options
Miscellaneous Options

bytes

USAGE: :program:`llvm-pdbutil` bytes [options] <input PDB file>

Summary

Like the dump subcommand, the bytes subcommand displays low level information about the structure of a PDB file, but it is used for even deeper forensics. The bytes subcommand finds various structures in a PDB file based on the command line options specified, and dumps them in hex. Someone working on support for emitting PDBs would use this heavily, for example, to compare one PDB against another PDB to ensure byte-for-byte compatibility. It is not enough to simply compare the bytes of an entire file, or an entire stream because it's perfectly fine for the same structure to exist at different locations in two different PDBs, and "finding" the structure is half the battle.

Options

MSF File Options
PDB Stream Options
DBI Stream Options
Module Options
Type Record Options

pdb2yaml

USAGE: :program:`llvm-pdbutil` pdb2yaml [options] <input PDB file>

Summary

Options

yaml2pdb

USAGE: :program:`llvm-pdbutil` yaml2pdb [options] <input YAML file>

Summary

Generate a PDB file from a YAML description. The YAML syntax is not described here. Instead, use :ref:`llvm-pdbutil pdb2yaml <pdb2yaml_subcommand>` and examine the output for an example starting point.

Options

Write the resulting PDB to the specified file.

merge

USAGE: :program:`llvm-pdbutil` merge [options] <input PDB file 1> <input PDB file 2>

Summary

Merge two PDB files into a single file.

Options

Write the resulting PDB to the specified file.