1 llvm-pdbutil - PDB File forensics and diagnostics
2 =================================================
10 :program:`llvm-pdbutil` [*subcommand*] [*options*]
15 Display types, symbols, CodeView records, and other information from a
16 PDB file, as well as manipulate and create PDB files. :program:`llvm-pdbutil`
17 is normally used by FileCheck-based tests to test LLVM's PDB reading and
18 writing functionality, but can also be used for general PDB file investigation
19 and forensics, or as a replacement for cvdump.
24 :program:`llvm-pdbutil` is separated into several subcommands each tailored to
25 a different purpose. A brief summary of each command follows, with more detail
26 in the sections that follow.
28 * :ref:`pretty_subcommand` - Dump symbol and type information in a format that
\r
29 tries to look as much like the original source code as possible.
30 * :ref:`dump_subcommand` - Dump low level types and structures from the PDB
\r
31 file, including CodeView records, hash tables, PDB streams, etc.
32 * :ref:`bytes_subcommand` - Dump data from the PDB file's streams, records,
\r
33 types, symbols, etc as raw bytes.
34 * :ref:`yaml2pdb_subcommand` - Given a yaml description of a PDB file, produce
\r
35 a valid PDB file that matches that description.
36 * :ref:`pdb2yaml_subcommand` - For a given PDB file, produce a YAML
\r
37 description of some or all of the file in a way that the PDB can be
\r
39 * :ref:`merge_subcommand` - Given two PDBs, produce a third PDB that is the
\r
40 result of merging the two input PDBs.
42 .. _pretty_subcommand:
47 .. program:: llvm-pdbutil pretty
50 The **pretty** subcommand is built on the Windows DIA SDK, and as such is not
\r
51 supported on non-Windows platforms.
53 USAGE: :program:`llvm-pdbutil` pretty [*options*] <input PDB file>
58 The *pretty* subcommand displays a very high level representation of your
\r
59 program's debug info. Since it is built on the Windows DIA SDK which is the
\r
60 standard API that Windows tools and debuggers query debug information, it
\r
61 presents a more authoritative view of how a debugger is going to interpret your
\r
62 debug information than a mode which displays low-level CodeView records.
67 Filtering and Sorting Options
68 +++++++++++++++++++++++++++++
71 *exclude* filters take priority over *include* filters. So if a filter
\r
72 matches both an include and an exclude rule, then it is excluded.
74 .. option:: -exclude-compilands=<string>
76 When dumping compilands, compiland source-file contributions, or per-compiland
\r
77 symbols, this option instructs **llvm-pdbutil** to omit any compilands that
\r
78 match the specified regular expression.
80 .. option:: -exclude-symbols=<string>
82 When dumping global, public, or per-compiland symbols, this option instructs
\r
83 **llvm-pdbutil** to omit any symbols that match the specified regular
\r
86 .. option:: -exclude-types=<string>
88 When dumping types, this option instructs **llvm-pdbutil** to omit any types
\r
89 that match the specified regular expression.
91 .. option:: -include-compilands=<string>
93 When dumping compilands, compiland source-file contributions, or per-compiland
\r
94 symbols, limit the initial search to only those compilands that match the
\r
95 specified regular expression.
97 .. option:: -include-symbols=<string>
99 When dumping global, public, or per-compiland symbols, limit the initial
\r
100 search to only those symbols that match the specified regular expression.
102 .. option:: -include-types=<string>
104 When dumping types, limit the initial search to only those types that match
\r
105 the specified regular expression.
107 .. option:: -min-class-padding=<uint>
109 Only display types that have at least the specified amount of alignment
\r
110 padding, accounting for padding in base classes and aggregate field members.
112 .. option:: -min-class-padding-imm=<uint>
114 Only display types that have at least the specified amount of alignment
\r
115 padding, ignoring padding in base classes and aggregate field members.
117 .. option:: -min-type-size=<uint>
119 Only display types T where sizeof(T) is greater than or equal to the specified
\r
122 .. option:: -no-compiler-generated
124 Don't show compiler generated types and symbols
126 .. option:: -no-enum-definitions
128 When dumping an enum, don't show the full enum (e.g. the individual enumerator
\r
131 .. option:: -no-system-libs
133 Don't show symbols from system libraries
139 Implies all other options in this category.
141 .. option:: -class-definitions=<format>
143 Displays class definitions in the specified format.
147 =all - Display all class members including data, constants, typedefs, functions, etc (default)
148 =layout - Only display members that contribute to class size.
149 =none - Don't display class definitions (e.g. only display the name and base list)
151 .. option:: -class-order
153 Displays classes in the specified order.
157 =none - Undefined / no particular sort order (default)
158 =name - Sort classes by name
159 =size - Sort classes by size
160 =padding - Sort classes by amount of padding
161 =padding-pct - Sort classes by percentage of space consumed by padding
162 =padding-imm - Sort classes by amount of immediate padding
163 =padding-pct-imm - Sort classes by percentage of space consumed by immediate padding
165 .. option:: -class-recurse-depth=<uint>
167 When dumping class definitions, stop after recursing the specified number of times. The
168 default is 0, which is no limit.
174 .. option:: -compilands
176 Display compilands (e.g. object files)
182 .. option:: -externals
184 Dump external (e.g. exported) symbols
192 Dump the mappings between source lines and code addresses.
194 .. option:: -module-syms
196 Display symbols (variables, functions, etc) for each compiland
198 .. option:: -sym-types=<types>
200 Type of symbols to dump when -globals, -externals, or -module-syms is
201 specified. (default all)
205 =thunks - Display thunk symbols
206 =data - Display data symbols
207 =funcs - Display function symbols
208 =all - Display all symbols (default)
210 .. option:: -symbol-order=<order>
212 For symbols dumped via the -module-syms, -globals, or -externals options, sort
213 the results in specified order.
217 =none - Undefined / no particular sort order
218 =name - Sort symbols by name
219 =size - Sort symbols by size
221 .. option:: -typedefs
223 Display typedef types
227 Display all types (implies -classes, -enums, -typedefs)
232 .. option:: -color-output
234 Force color output on or off. By default, color if used if outputting to a
\r
237 .. option:: -load-address=<uint>
239 When displaying relative virtual addresses, assume the process is loaded at the
\r
240 given address and display what would be the absolute address.
247 USAGE: :program:`llvm-pdbutil` dump [*options*] <input PDB file>
249 .. program:: llvm-pdbutil dump
254 The **dump** subcommand displays low level information about the structure of a
\r
255 PDB file. It is used heavily by LLVM's testing infrastructure, but can also be
\r
256 used for PDB forensics. It serves a role similar to that of Microsoft's
\r
260 The **dump** subcommand exposes internal details of the file format. As
\r
261 such, the reader should be familiar with :doc:`/PDB/index` before using this
\r
267 MSF Container Options
268 +++++++++++++++++++++
272 dump a summary of all of the streams in the PDB file.
274 .. option:: -stream-blocks
276 In conjunction with :option:`-streams`, add information to the output about
277 what blocks the specified stream occupies.
281 Dump MSF and PDB header information.
283 Module & File Options
284 +++++++++++++++++++++
286 .. option:: -modi=<uint>
288 For all options that dump information from each module/compiland, limit to
289 the specified module.
293 Dump the source files that contribute to each displayed module.
297 Dump inlinee line information (DEBUG_S_INLINEELINES CodeView subsection)
301 Dump line information (DEBUG_S_LINES CodeView subsection)
305 Dump compiland information
309 Dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS CodeView subsection)
313 Dump cross module imports (DEBUG_S_CROSSSCOPEIMPORTS CodeView subsection)
320 dump global symbol records
322 .. option:: -global-extras
324 dump additional information about the globals, such as hash buckets and hash
329 dump public symbol records
331 .. option:: -public-extras
333 dump additional information about the publics, such as hash buckets and hash
338 dump symbols (functions, variables, etc) for each module dumped.
340 .. option:: -sym-data
342 For each symbol record dumped as a result of the :option:`-symbols` option,
343 display the full bytes of the record in binary as well.
350 Dump CodeView type records from TPI stream
352 .. option:: -type-extras
354 Dump additional information from the TPI stream, such as hashes and the type
357 .. option:: -type-data
359 For each type record dumped, display the full bytes of the record in binary as
362 .. option:: -type-index=<uint>
364 Only dump types with the specified type index.
368 Dump CodeView type records from IPI stream.
370 .. option:: -id-extras
372 Dump additional information from the IPI stream, such as hashes and the type
377 For each ID record dumped, display the full bytes of the record in binary as
380 .. option:: -id-index=<uint>
382 only dump ID records with the specified hexadecimal type index.
384 .. option:: -dependents
386 When used in conjunction with :option:`-type-index` or :option:`-id-index`,
387 dumps the entire dependency graph for the specified index instead of just the
388 single record with the specified index. For example, if type index 0x4000 is
389 a function whose return type has index 0x3000, and you specify
\r
390 `-dependents=0x4000`, then this would dump both records (as well as any other
\r
391 dependents in the tree).
393 Miscellaneous Options
394 +++++++++++++++++++++
398 Implies most other options.
400 .. option:: -section-contribs
402 Dump section contributions.
404 .. option:: -section-headers
406 Dump image section headers.
408 .. option:: -section-map
412 .. option:: -string-table
414 Dump PDB string table.
416 .. _bytes_subcommand:
421 USAGE: :program:`llvm-pdbutil` bytes [*options*] <input PDB file>
423 .. program:: llvm-pdbutil bytes
428 Like the **dump** subcommand, the **bytes** subcommand displays low level
429 information about the structure of a PDB file, but it is used for even deeper
430 forensics. The **bytes** subcommand finds various structures in a PDB file
431 based on the command line options specified, and dumps them in hex. Someone
432 working on support for emitting PDBs would use this heavily, for example, to
433 compare one PDB against another PDB to ensure byte-for-byte compatibility. It
434 is not enough to simply compare the bytes of an entire file, or an entire stream
435 because it's perfectly fine for the same structure to exist at different
436 locations in two different PDBs, and "finding" the structure is half the battle.
444 .. option:: -block-range=<start[-end]>
446 Dump binary data from specified range of MSF file blocks.
448 .. option:: -byte-range=<start[-end]>
450 Dump binary data from specified range of bytes in the file.
454 Dump the MSF free page map.
456 .. option:: -stream-data=<string>
458 Dump binary data from the specified streams. Format is SN[:Start][@Size].
459 For example, `-stream-data=7:3@12` dumps 12 bytes from stream 7, starting
460 at offset 3 in the stream.
465 .. option:: -name-map
467 Dump bytes of PDB Name Map
474 Dump the edit and continue map substream of the DBI stream.
478 Dump the file info substream of the DBI stream.
482 Dump the modi substream of the DBI stream.
486 Dump section contributions substream of the DBI stream.
490 Dump the section map from the DBI stream.
492 .. option:: -type-server
494 Dump the type server map from the DBI stream.
499 .. option:: -mod=<uint>
501 Limit all options in this category to the specified module index. By default,
502 options in this category will dump bytes from all modules.
506 Dump the bytes of each module's C13 debug subsection.
508 .. option:: -split-chunks
510 When specified with :option:`-chunks`, split the C13 debug subsection into a
511 separate chunk for each subsection type, and dump them separately.
515 Dump the symbol record substream from each module.
520 .. option:: -id=<uint>
522 Dump the record from the IPI stream with the given type index.
524 .. option:: -type=<uint>
526 Dump the record from the TPI stream with the given type index.
528 .. _pdb2yaml_subcommand:
533 USAGE: :program:`llvm-pdbutil` pdb2yaml [*options*] <input PDB file>
535 .. program:: llvm-pdbutil pdb2yaml
543 .. _yaml2pdb_subcommand:
548 USAGE: :program:`llvm-pdbutil` yaml2pdb [*options*] <input YAML file>
550 .. program:: llvm-pdbutil yaml2pdb
555 Generate a PDB file from a YAML description. The YAML syntax is not described
556 here. Instead, use :ref:`llvm-pdbutil pdb2yaml <pdb2yaml_subcommand>` and
557 examine the output for an example starting point.
562 .. option:: -pdb=<file-name>
564 Write the resulting PDB to the specified file.
566 .. _merge_subcommand:
571 USAGE: :program:`llvm-pdbutil` merge [*options*] <input PDB file 1> <input PDB file 2>
573 .. program:: llvm-pdbutil merge
578 Merge two PDB files into a single file.
583 .. option:: -pdb=<file-name>
585 Write the resulting PDB to the specified file.