LLVM-PDBUTIL(1)

πŸ’… LLVM-PDBUTIL(1) β€” PDB File forensics and diagnostics

okay bestie, this one's from the LLVM manual set (section 1 of the manual pages, iykyk) and it is the blueprint for snooping through PDB files. buckle up πŸŽ€


πŸ—‚οΈ what's inside (the table of contents, slay)

  • Synopsis
  • Description
  • Subcommands
    • pretty
      • Summary
      • Options
        • Filtering and Sorting Options
        • Symbol Type Options
        • Other Options
    • dump
      • Summary
      • Options
        • MSF Container Options
        • Module & File Options
        • Symbol Options
        • Type Record Options
        • Miscellaneous Options
    • bytes
      • Summary
      • Options
        • MSF File Options
        • PDB Stream Options
        • DBI Stream Options
        • Module Options
        • Type Record Options
    • pdb2yaml
      • Summary
      • Options
    • yaml2pdb
      • Summary
      • Options
    • merge
      • Summary
      • Options

✨ SYNOPSIS

llvm-pdbutil [subcommand] [options]

🌸 DESCRIPTION

so basically llvm-pdbutil displays types, symbols, CodeView records, and other information from a PDB file β€” and it also manipulates and creates PDB files. like it does both, icon behavior πŸ’…

ngl, llvm-pdbutil is normally used by FileCheck-based tests to test LLVM's PDB reading and writing functionality. but it can also absolutely be used for general PDB file investigation and forensics, or as a replacement for cvdump. main character energy fr fr πŸ•΅οΈβ€β™€οΈ


πŸ¦‹ SUBCOMMANDS

llvm-pdbutil is separated into several subcommands, each one tailored to a different purpose. brief summary of each below, with the full deets in the sections that follow πŸ‘‡

  • pretty β€” dump symbol and type information in a format that tries to look as much like the original source code as possible.
  • dump β€” dump low level types and structures from the PDB file, including CodeView records, hash tables, PDB streams, etc.
  • bytes β€” dump data from the PDB file's streams, records, types, symbols, etc as raw bytes.
  • yaml2pdb β€” given a yaml description of a PDB file, produce a valid PDB file that matches that description.
  • pdb2yaml β€” 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.
  • merge β€” 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. πŸ’€ so if you're on Linux or macOS, this one is not for you, sorry bestie 😭
USAGE: llvm-pdbutil pretty [options] <input PDB file>

Summary

the pretty subcommand displays a very high level representation of your program's debug info. and since it's built on the Windows DIA SDK β€” which is the standard API that Windows tools and debuggers query debug information through β€” it gives you a way more authoritative view of how a debugger is actually going to interpret your debug information than a mode that displays low-level CodeView records. it's giving "the debugger's own opinion" πŸ‘‘

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. no take-backs, periodt.
  • -exclude-compilands=<string> β€” when dumping compilands, compiland source-file contributions, or per-compiland symbols, this tells llvm-pdbutil to omit any compilands that match the specified regular expression.
  • -exclude-symbols=<string> β€” when dumping global, public, or per-compiland symbols, this tells llvm-pdbutil to omit any symbols that match the specified regular expression.
  • -exclude-types=<string> β€” when dumping types, this tells llvm-pdbutil to omit any types that match the specified regular expression.
  • -include-compilands=<string> β€” when dumping compilands, compiland source-file contributions, or per-compiland symbols, limit the initial search to only those compilands that match the specified regular expression.
  • -include-symbols=<string> β€” when dumping global, public, or per-compiland symbols, limit the initial search to only those symbols that match the specified regular expression.
  • -include-types=<string> β€” when dumping types, limit the initial search to only those types that match the specified regular expression.
  • -min-class-padding=<uint> β€” only display types that have at least the specified amount of alignment padding, accounting for padding in base classes and aggregate field members.
  • -min-class-padding-imm=<uint> β€” only display types that have at least the specified amount of alignment padding, ignoring padding in base classes and aggregate field members.
  • -min-type-size=<uint> β€” only display types T where sizeof(T) is greater than or equal to the specified amount.
  • -no-compiler-generated β€” don't show compiler generated types and symbols.
  • -no-enum-definitions β€” when dumping an enum, don't show the full enum (e.g. the individual enumerator values).
  • -no-system-libs β€” don't show symbols from system libraries.

🏷️ Symbol Type Options

  • -all β€” implies all other options in this category. the greedy icon we love 🫢
  • -class-definitions=<format> β€” displays class definitions in the specified format:
    • =all β€” display all class members including data, constants, typedefs, functions, etc (default)
    • =layout β€” only display members that contribute to class size.
    • =none β€” don't display class definitions (e.g. only display the name and base list)
  • -class-order β€” displays classes in the specified order:
    • =none β€” undefined / no particular sort order (default)
    • =name β€” sort classes by name
    • =size β€” sort classes by size
    • =padding β€” sort classes by amount of padding
    • =padding-pct β€” sort classes by percentage of space consumed by padding
    • =padding-imm β€” sort classes by amount of immediate padding
    • =padding-pct-imm β€” sort classes by percentage of space consumed by immediate padding
  • -class-recurse-depth=<uint> β€” when dumping class definitions, stop after recursing the specified number of times. the default is 0, which is no limit. (yes, zero means infinite here, don't ask πŸ˜…)
  • -classes β€” display classes.
  • -compilands β€” display compilands (e.g. object files).
  • -enums β€” display enums.
  • -externals β€” dump external (e.g. exported) symbols.
  • -globals β€” dump global symbols.
  • -lines β€” dump the mappings between source lines and code addresses.
  • -module-syms β€” display symbols (variables, functions, etc) for each compiland.
  • -sym-types=<types> β€” type of symbols to dump when -globals, -externals, or -module-syms is specified. (default all)
    • =thunks β€” display thunk symbols
    • =data β€” display data symbols
    • =funcs β€” display function symbols
    • =all β€” display all symbols (default)
  • -symbol-order=<order> β€” for symbols dumped via the -module-syms, -globals, or -externals options, sort the results in specified order:
    • =none β€” undefined / no particular sort order
    • =name β€” sort symbols by name
    • =size β€” sort symbols by size
  • -typedefs β€” display typedef types.
  • -types β€” display all types (implies -classes, -enums, -typedefs).

🎨 Other Options

  • -color-output β€” force color output on or off. by default, color if used if outputting to a terminal. (yeah the phrasing is a little quirky, but that's what it says πŸ’œ)
  • -load-address=<uint> β€” when displaying relative virtual addresses, assume the process is loaded at the given address and display what would be the absolute address.

🧚 dump

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

Summary

the dump subcommand displays low level information about the structure of a PDB file. LLVM's testing infrastructure uses it heavily, but you can also absolutely use it for PDB forensics. it serves a role similar to that of Microsoft's cvdump tool. the way it gets down into the guts of the file 🫣

NOTE: the dump subcommand exposes internal details of the file format. as such, you should be familiar with The PDB File Format before using this command. like, actually read it, bestie β€” this is not a vibes-only zone πŸ™ˆ

Options

πŸ“¦ MSF Container Options

  • -streams β€” dump a summary of all of the streams in the PDB file.
  • -stream-blocks β€” in conjunction with -streams, add information to the output about what blocks the specified stream occupies.
  • -summary β€” dump MSF and PDB header information.

πŸ“ Module & File Options

  • -modi=<uint> β€” for all options that dump information from each module/compiland, limit to the specified module.
  • -files β€” dump the source files that contribute to each displayed module.
  • -il β€” dump inlinee line information (DEBUG_S_INLINEELINES CodeView subsection).
  • -l β€” dump line information (DEBUG_S_LINES CodeView subsection).
  • -modules β€” dump compiland information.
  • -xme β€” dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS CodeView subsection).
  • -xmi β€” dump cross module imports (DEBUG_S_CROSSSCOPEIMPORTS CodeView subsection).

πŸ”– Symbol Options

  • -globals β€” dump global symbol records.
  • -global-extras β€” dump additional information about the globals, such as hash buckets and hash values.
  • -publics β€” dump public symbol records.
  • -public-extras β€” dump additional information about the publics, such as hash buckets and hash values.
  • -symbols β€” dump symbols (functions, variables, etc) for each module dumped.
  • -sym-data β€” for each symbol record dumped as a result of the -symbols option, display the full bytes of the record in binary as well.

🧬 Type Record Options

  • -types β€” dump CodeView type records from TPI stream.
  • -type-extras β€” dump additional information from the TPI stream, such as hashes and the type index offsets array.
  • -type-data β€” for each type record dumped, display the full bytes of the record in binary as well.
  • -type-index=<uint> β€” only dump types with the specified type index.
  • -ids β€” dump CodeView type records from IPI stream.
  • -id-extras β€” dump additional information from the IPI stream, such as hashes and the type index offsets array.
  • -id-data β€” for each ID record dumped, display the full bytes of the record in binary as well.
  • -id-index=<uint> β€” only dump ID records with the specified hexadecimal type index.

okay and that's where part 1 wraps, but do NOT close the tab β€” more parts are coming, and they're just as iconic πŸŒˆπŸ’–

  • -dependents β€” okay so when you use this with -type-index or -id-index, it dumps the entire dependency graph for the index you picked instead of just that one single record. Example time: if type index 0x4000 is a function whose return type has index 0x3000, and you specify -dependents=0x4000, then this would dump both records (plus any other dependents in the tree). It's giving main character energy for the whole tree, fr fr. πŸŒ³πŸ’…

πŸŽ€ Miscellaneous Options πŸŽ€

  • -all β€” implies most other options. It's the "yes to everything" vibe, no cap. ✨
  • -section-contribs β€” dump section contributions.
  • -section-headers β€” dump image section headers.
  • -section-map β€” dump section map.
  • -string-table β€” dump PDB string table.

πŸ¦‹ bytes πŸ¦‹

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

🌸 Summary 🌸

Like the dump subcommand, the bytes subcommand displays low level info about the structure of a PDB file, but bestie, it's for even deeper forensics. The bytes subcommand finds various structures in a PDB file based on the command line options you specify, 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. Lowkey iconic. πŸ”πŸ’–

✨ Options ✨

MSF File Options

  • -block-range=<start[-end]> β€” dump binary data from specified range of MSF file blocks.
  • -byte-range=<start[-end]> β€” dump binary data from specified range of bytes in the file.
  • -fpm β€” dump the MSF free page map.
  • -stream-data=<string> β€” dump binary data from the specified streams. Format is SN[:Start][@Size]. For example, -stream-data=7:3@12 dumps 12 bytes from stream 7, starting at offset 3 in the stream. Slay. 🫢

PDB Stream Options

  • -name-map β€” dump bytes of PDB Name Map

DBI Stream Options

  • -ec β€” dump the edit and continue map substream of the DBI stream.
  • -files β€” dump the file info substream of the DBI stream.
  • -modi β€” dump the modi substream of the DBI stream.
  • -sc β€” dump section contributions substream of the DBI stream.
  • -sm β€” dump the section map from the DBI stream.
  • -type-server β€” dump the type server map from the DBI stream.

Module Options

  • -mod=<uint> β€” limit all options in this category to the specified module index. By default, options in this category will dump bytes from all modules.
  • -chunks β€” dump the bytes of each module's C13 debug subsection.
  • -split-chunks β€” when specified with -chunks, split the C13 debug subsection into a separate chunk for each subsection type, and dump them separately.
  • -syms β€” dump the symbol record substream from each module.

Type Record Options

  • -id=<uint> β€” dump the record from the IPI stream with the given type index.
  • -type=<uint> β€” dump the record from the TPI stream with the given type index.

🧚 pdb2yaml 🧚

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

πŸ¦‹ Summary πŸ¦‹

(The original leaves this one blank β€” not me being lazy, it's literally empty πŸ’€)

✨ Options ✨

(also blank β€” no options listed here, iykyk)


🌈 yaml2pdb 🌈

USAGE: 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 llvm-pdbutil pdb2yaml and examine the output for an example starting point. It's giving DIY energy but make it PDB. πŸŽ€

✨ Options ✨

  • -pdb=<file-name> β€” write the resulting PDB to the specified file. Periodt. πŸ’…

πŸ’œ merge πŸ’œ

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

πŸ¦‹ Summary πŸ¦‹

Merge two PDB files into a single file. Bestie, it's a PDB crossover episode. πŸ”₯

✨ Options ✨

  • -pdb=<file-name> β€” write the resulting PDB to the specified file. Same vibe, different subcommand. 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/). Protect them at all costs. 🧚

2003-2023, LLVM Project


Signed off with so much love β€” LLVM-PDBUTIL(1), dated 2023-12-01, page 17. No cap, you ate this whole manpage. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from