xref: /llvm-project/llvm/docs/CommandGuide/llvm-dwarfutil.rst (revision 4539b44148918c332ff966a2a955aca0ab93dde4)
1*4539b441SAlexey Lapshinllvm-dwarfutil - A tool to copy and manipulate debug info
2*4539b441SAlexey Lapshin=========================================================
3*4539b441SAlexey Lapshin
4*4539b441SAlexey Lapshin.. program:: llvm-dwarfutil
5*4539b441SAlexey Lapshin
6*4539b441SAlexey LapshinSYNOPSIS
7*4539b441SAlexey Lapshin--------
8*4539b441SAlexey Lapshin
9*4539b441SAlexey Lapshin:program:`llvm-dwarfutil` [*options*] *input* *output*
10*4539b441SAlexey Lapshin
11*4539b441SAlexey LapshinDESCRIPTION
12*4539b441SAlexey Lapshin-----------
13*4539b441SAlexey Lapshin
14*4539b441SAlexey Lapshin:program:`llvm-dwarfutil` is a tool to copy and manipulate debug info.
15*4539b441SAlexey Lapshin
16*4539b441SAlexey LapshinIn basic usage, it makes a semantic copy of the input to the output. If any
17*4539b441SAlexey Lapshinoptions are specified, the output may be modified along the way, e.g.
18*4539b441SAlexey Lapshinby removing unused debug info.
19*4539b441SAlexey Lapshin
20*4539b441SAlexey LapshinIf "-" is specified for the input file, the input is read from the program's
21*4539b441SAlexey Lapshinstandard input stream. If "-" is specified for the output file, the output
22*4539b441SAlexey Lapshinis written to the standard output stream of the program.
23*4539b441SAlexey Lapshin
24*4539b441SAlexey LapshinThe tool is still in active development.
25*4539b441SAlexey Lapshin
26*4539b441SAlexey LapshinCOMMAND-LINE OPTIONS
27*4539b441SAlexey Lapshin--------------------
28*4539b441SAlexey Lapshin
29*4539b441SAlexey Lapshin.. option:: --garbage-collection
30*4539b441SAlexey Lapshin
31*4539b441SAlexey Lapshin Removes pieces of debug information related to discarded sections.
32*4539b441SAlexey Lapshin When the linker does section garbage collection the abandoned debug info
33*4539b441SAlexey Lapshin is left behind. Such abandoned debug info references address ranges using
34*4539b441SAlexey Lapshin tombstone values. Thus, when this option is specified, the tool removes
35*4539b441SAlexey Lapshin debug info which is marked with the tombstone value.
36*4539b441SAlexey Lapshin
37*4539b441SAlexey Lapshin That option is enabled by default.
38*4539b441SAlexey Lapshin
39*4539b441SAlexey Lapshin.. option:: --odr-deduplication
40*4539b441SAlexey Lapshin
41*4539b441SAlexey Lapshin Remove duplicated types (if "One Definition Rule" is supported by source
42*4539b441SAlexey Lapshin language). Keeps first type definition and removes other definitions,
43*4539b441SAlexey Lapshin potentially significantly reducing the size of output debug info.
44*4539b441SAlexey Lapshin
45*4539b441SAlexey Lapshin That option is enabled by default.
46*4539b441SAlexey Lapshin
47*4539b441SAlexey Lapshin.. option:: --help, -h
48*4539b441SAlexey Lapshin
49*4539b441SAlexey Lapshin Print a summary of command line options.
50*4539b441SAlexey Lapshin
51*4539b441SAlexey Lapshin.. option:: --no-garbage-collection
52*4539b441SAlexey Lapshin
53*4539b441SAlexey Lapshin Disable :option:`--garbage-collection`.
54*4539b441SAlexey Lapshin
55*4539b441SAlexey Lapshin.. option:: --no-odr-deduplication
56*4539b441SAlexey Lapshin
57*4539b441SAlexey Lapshin Disable :option:`--odr-deduplication`.
58*4539b441SAlexey Lapshin
59*4539b441SAlexey Lapshin.. option:: --no-separate-debug-file
60*4539b441SAlexey Lapshin
61*4539b441SAlexey Lapshin Disable :option:`--separate-debug-file`.
62*4539b441SAlexey Lapshin
63*4539b441SAlexey Lapshin.. option:: --num-threads=<n>, -j
64*4539b441SAlexey Lapshin
65*4539b441SAlexey Lapshin Specifies the maximum number (`n`) of simultaneous threads to use
66*4539b441SAlexey Lapshin for processing.
67*4539b441SAlexey Lapshin
68*4539b441SAlexey Lapshin.. option:: --separate-debug-file
69*4539b441SAlexey Lapshin
70*4539b441SAlexey Lapshin Generate separate file containing output debug info. Using
71*4539b441SAlexey Lapshin :program:`llvm-dwarfutil` with that option equals to the
72*4539b441SAlexey Lapshin following set of commands:
73*4539b441SAlexey Lapshin
74*4539b441SAlexey Lapshin.. code-block:: console
75*4539b441SAlexey Lapshin
76*4539b441SAlexey Lapshin :program:`llvm-objcopy` --only-keep-debug in-file out-file.debug
77*4539b441SAlexey Lapshin :program:`llvm-objcopy` --strip-debug in-file out-file
78*4539b441SAlexey Lapshin :program:`llvm-objcopy` --add-gnu-debuglink=out-file.debug out-file
79*4539b441SAlexey Lapshin
80*4539b441SAlexey Lapshin.. option:: --tombstone=<value>
81*4539b441SAlexey Lapshin
82*4539b441SAlexey Lapshin <value> can be one of the following values:
83*4539b441SAlexey Lapshin
84*4539b441SAlexey Lapshin   - `bfd`: zero for all addresses and [1,1] for DWARF v4 (or less) address ranges and exec.
85*4539b441SAlexey Lapshin
86*4539b441SAlexey Lapshin   - `maxpc`: -1 for all addresses and -2 for DWARF v4 (or less) address ranges.
87*4539b441SAlexey Lapshin
88*4539b441SAlexey Lapshin   - `universal`: both `bfd` and `maxpc`.
89*4539b441SAlexey Lapshin
90*4539b441SAlexey Lapshin   - `exec`: match with address ranges of executable sections.
91*4539b441SAlexey Lapshin
92*4539b441SAlexey Lapshin   The value `universal` is used by default.
93*4539b441SAlexey Lapshin
94*4539b441SAlexey Lapshin.. option:: --verbose
95*4539b441SAlexey Lapshin
96*4539b441SAlexey Lapshin Enable verbose logging. This option disables multi-thread mode.
97*4539b441SAlexey Lapshin
98*4539b441SAlexey Lapshin.. option:: --verify
99*4539b441SAlexey Lapshin
100*4539b441SAlexey Lapshin Run the DWARF verifier on the output DWARF debug info.
101*4539b441SAlexey Lapshin
102*4539b441SAlexey Lapshin.. option:: --version
103*4539b441SAlexey Lapshin
104*4539b441SAlexey Lapshin Print the version of this program.
105*4539b441SAlexey Lapshin
106*4539b441SAlexey LapshinSUPPORTED FORMATS
107*4539b441SAlexey Lapshin-----------------
108*4539b441SAlexey Lapshin
109*4539b441SAlexey LapshinThe following formats are currently supported by :program:`llvm-dwarfutil`:
110*4539b441SAlexey Lapshin
111*4539b441SAlexey LapshinELF
112*4539b441SAlexey Lapshin
113*4539b441SAlexey LapshinEXIT STATUS
114*4539b441SAlexey Lapshin-----------
115*4539b441SAlexey Lapshin
116*4539b441SAlexey Lapshin:program:`llvm-dwarfutil` exits with a non-zero exit code if there is an error.
117*4539b441SAlexey LapshinOtherwise, it exits with code 0.
118*4539b441SAlexey Lapshin
119*4539b441SAlexey LapshinBUGS
120*4539b441SAlexey Lapshin----
121*4539b441SAlexey Lapshin
122*4539b441SAlexey LapshinTo report bugs, please visit <https://github.com/llvm/llvm-project/labels/tools:llvm-dwarfutil/>.
123