blob: d0c7be44213655dc45ebc83debe986fc92818339 [file] [log] [blame]
Adrian Prantlf01b3f32017-10-03 23:46:57 +00001llvm-dwarfdump - dump and verify DWARF debug information
2========================================================
Alexey Samsonova47b11a2014-05-19 22:53:29 +00003
James Hendersona0566842019-06-27 13:24:46 +00004.. program:: llvm-dwarfdump
5
Alexey Samsonova47b11a2014-05-19 22:53:29 +00006SYNOPSIS
7--------
8
Adrian Prantlf01b3f32017-10-03 23:46:57 +00009:program:`llvm-dwarfdump` [*options*] [*filename ...*]
Alexey Samsonova47b11a2014-05-19 22:53:29 +000010
11DESCRIPTION
12-----------
13
Adrian Prantlf01b3f32017-10-03 23:46:57 +000014:program:`llvm-dwarfdump` parses DWARF sections in object files,
15archives, and `.dSYM` bundles and prints their contents in
16human-readable form. Only the .debug_info section is printed unless one of
17the section-specific options or :option:`--all` is specified.
Alexey Samsonova47b11a2014-05-19 22:53:29 +000018
James Henderson86b510a2019-06-13 13:53:16 +000019If no input file is specified, `a.out` is used instead. If `-` is used as the
20input file, :program:`llvm-dwarfdump` reads the input from its standard input
21stream.
22
Alexey Samsonova47b11a2014-05-19 22:53:29 +000023OPTIONS
24-------
25
Adrian Prantlf01b3f32017-10-03 23:46:57 +000026.. option:: -a, --all
Alexey Samsonova47b11a2014-05-19 22:53:29 +000027
James Henderson66641422019-07-10 08:56:13 +000028 Dump all supported DWARF sections.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000029
30.. option:: --arch=<arch>
31
32 Dump DWARF debug information for the specified CPU architecture.
33 Architectures may be specified by name or by number. This
34 option can be specified multiple times, once for each desired
35 architecture. All CPU architectures will be printed by
36 default.
37
38.. option:: -c, --show-children
39
James Henderson891cdaa2019-06-14 13:00:09 +000040 Show a debug info entry's children when selectively printing with
41 the `=<offset>` argument of :option:`--debug-info`, or options such
42 as :option:`--find` or :option:`--name`.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000043
James Henderson86b510a2019-06-13 13:53:16 +000044.. option:: --color
45
46 Use colors in output.
47
Adrian Prantlf01b3f32017-10-03 23:46:57 +000048.. option:: -f <name>, --find=<name>
49
50 Search for the exact text <name> in the accelerator tables
51 and print the matching debug information entries.
52 When there is no accelerator tables or the name of the DIE
53 you are looking for is not found in the accelerator tables,
54 try using the slower but more complete :option:`--name` option.
55
56.. option:: -F, --show-form
57
58 Show DWARF form types after the DWARF attribute types.
59
60.. option:: -h, --help
61
62 Show help and usage for this command.
63
James Henderson86b510a2019-06-13 13:53:16 +000064.. option:: --help-list
65
66 Show help and usage for this command without grouping the options
67 into categories.
68
Adrian Prantlf01b3f32017-10-03 23:46:57 +000069.. option:: -i, --ignore-case
70
James Henderson4363edb2019-07-09 10:03:12 +000071 Ignore case distinctions when using :option:`--name`.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000072
James Henderson4363edb2019-07-09 10:03:12 +000073.. option:: -n <name>, --name=<name>
Adrian Prantlf01b3f32017-10-03 23:46:57 +000074
75 Find and print all debug info entries whose name
James Henderson4363edb2019-07-09 10:03:12 +000076 (`DW_AT_name` attribute) is <name>.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000077
78.. option:: --lookup=<address>
79
James Hendersone0a3ee72019-07-09 14:20:58 +000080 Look up <address> in the debug information and print out the file,
Adrian Prantlf01b3f32017-10-03 23:46:57 +000081 function, block, and line table details.
82
James Hendersond5f38da2019-06-11 10:20:07 +000083.. option:: -o <path>
Adrian Prantlf01b3f32017-10-03 23:46:57 +000084
James Henderson86b510a2019-06-13 13:53:16 +000085 Redirect output to a file specified by <path>, where `-` is the
86 standard output stream.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000087
88.. option:: -p, --show-parents
89
James Henderson891cdaa2019-06-14 13:00:09 +000090 Show a debug info entry's parents when selectively printing with
91 the `=<offset>` argument of :option:`--debug-info`, or options such
92 as :option:`--find` or :option:`--name`.
Adrian Prantlf01b3f32017-10-03 23:46:57 +000093
James Henderson86b510a2019-06-13 13:53:16 +000094.. option:: --parent-recurse-depth=<N>
Adrian Prantlf01b3f32017-10-03 23:46:57 +000095
James Henderson4363edb2019-07-09 10:03:12 +000096 When displaying debug info entry parents, only show them to a
97 maximum depth of <N>.
James Henderson86b510a2019-06-13 13:53:16 +000098
99.. option:: --quiet
100
101 Use with :option:`--verify` to not emit to `STDOUT`.
102
103.. option:: -r <N>, --recurse-depth=<N>
104
James Henderson4363edb2019-07-09 10:03:12 +0000105 When displaying debug info entries, only show children to a maximum
106 depth of <N>.
Adrian Prantlf01b3f32017-10-03 23:46:57 +0000107
Djordje Todorovic5e508b92020-04-02 10:58:27 +0200108.. option:: --show-section-sizes
109
110 Show the sizes of all debug sections, expressed in bytes.
111
Adrian Prantl59f30b82017-10-06 20:24:34 +0000112.. option:: --statistics
113
114 Collect debug info quality metrics and print the results
Djordje Todorovic0a4defe2020-04-23 12:14:13 +0200115 as machine-readable single-line JSON output. The output
116 format is described in the section below (:ref:`stats-format`).
Adrian Prantl59f30b82017-10-06 20:24:34 +0000117
James Henderson86b510a2019-06-13 13:53:16 +0000118.. option:: --summarize-types
119
120 Abbreviate the description of type unit entries.
121
Adrian Prantlf01b3f32017-10-03 23:46:57 +0000122.. option:: -x, --regex
123
James Henderson4363edb2019-07-09 10:03:12 +0000124 Treat any <name> strings as regular expressions when searching
125 with :option:`--name`. If :option:`--ignore-case` is also specified,
126 the regular expression becomes case-insensitive.
Adrian Prantlf01b3f32017-10-03 23:46:57 +0000127
128.. option:: -u, --uuid
129
130 Show the UUID for each architecture.
131
132.. option:: --diff
133
134 Dump the output in a format that is more friendly for comparing
135 DWARF output from two different files.
136
137.. option:: -v, --verbose
138
139 Display verbose information when dumping. This can help to debug
140 DWARF issues.
141
142.. option:: --verify
143
144 Verify the structure of the DWARF information by verifying the
145 compile unit chains, DIE relationships graph, address
146 ranges, and more.
147
148.. option:: --version
149
150 Display the version of the tool.
151
Djordje Todorovic95435112020-06-25 10:54:37 +0200152.. option:: --debug-abbrev, --debug-addr, --debug-aranges, --debug-cu-index, --debug-frame[=<offset>], --debug-gnu-pubnames, --debug-gnu-pubtypes, --debug-info [=<offset>], --debug-line [=<offset>], --debug-line-str, --debug-loc [=<offset>], --debug-loclists [=<offset>], --debug-macro, --debug-names, --debug-pubnames, --debug-pubtypes, --debug-ranges, --debug-rnglists, --debug-str, --debug-str-offsets, --debug-tu-index, --debug-types [=<offset>], --eh-frame [=<offset>], --gdb-index, --apple-names, --apple-types, --apple-namespaces, --apple-objc
Adrian Prantlf01b3f32017-10-03 23:46:57 +0000153
154 Dump the specified DWARF section by name. Only the
155 `.debug_info` section is shown by default. Some entries
156 support adding an `=<offset>` as a way to provide an
157 optional offset of the exact entry to dump within the
158 respective section. When an offset is provided, only the
159 entry at that offset will be dumped, else the entire
James Henderson38d99032019-07-04 08:49:04 +0000160 section will be dumped.
Alexey Samsonova47b11a2014-05-19 22:53:29 +0000161
James Henderson86b510a2019-06-13 13:53:16 +0000162.. option:: @<FILE>
163
164 Read command-line options from `<FILE>`.
165
Djordje Todorovic0a4defe2020-04-23 12:14:13 +0200166.. _stats-format:
167
168FORMAT OF STATISTICS OUTPUT
169---------------------------
170
171The ::option:`--statistics` option generates single-line JSON output
172representing quality metrics of the processed debug info. These metrics are
173useful to compare changes between two compilers, particularly for judging
174the effect that a change to the compiler has on the debug info quality.
175
176The output is formatted as key-value pairs. The first pair contains a version
177number. The following naming scheme is used for the keys:
178
179 - `variables` ==> local variables and parameters
180 - `local vars` ==> local variables
181 - `params` ==> formal parameters
182
183For aggregated values, the following keys are used:
184
185 - `sum_of_all_variables(...)` ==> the sum applied to all variables
186 - `#bytes` ==> the number of bytes
187 - `#variables - entry values ...` ==> the number of variables excluding
188 the entry values etc.
189
Alexey Samsonova47b11a2014-05-19 22:53:29 +0000190EXIT STATUS
191-----------
192
Alexey Samsonov85c7d662015-06-25 23:40:15 +0000193:program:`llvm-dwarfdump` returns 0 if the input files were parsed and dumped
194successfully. Otherwise, it returns 1.
Adrian Prantlf01b3f32017-10-03 23:46:57 +0000195
196SEE ALSO
197--------
198
Jonas Devliegherefb7bf1d2017-11-02 18:44:54 +0000199:manpage:`dsymutil(1)`