1LLVM-SYMBOLIZER(1)                   LLVM                   LLVM-SYMBOLIZER(1)
2
3
4

NAME

6       llvm-symbolizer - convert addresses into source code locations
7

SYNOPSIS

9       llvm-symbolizer [options] [addresses...]
10

DESCRIPTION

12       llvm-symbolizer  reads  object  file  names and addresses from the com‐
13       mand-line and prints corresponding source code  locations  to  standard
14       output.
15
16       If  no address is specified on the command-line, it reads the addresses
17       from standard input. If  no  object  file  is  specified  on  the  com‐
18       mand-line,  but  addresses are, or if at any time an input value is not
19       recognized, the input is simply echoed to the output.
20
21       A positional argument or standard input value can be preceded by "DATA"
22       or  "CODE" to indicate that the address should be symbolized as data or
23       executable code respectively. If neither is specified,  "CODE"  is  as‐
24       sumed.  DATA  is symbolized as address and symbol size rather than line
25       number.
26
27       Object files can be specified together with  the  addresses  either  on
28       standard  input or as positional arguments on the command-line, follow‐
29       ing any "DATA" or "CODE" prefix.
30
31       llvm-symbolizer parses options from the environment variable  LLVM_SYM‐
32       BOLIZER_OPTS after parsing options from the command line.  LLVM_SYMBOL‐
33       IZER_OPTS is primarily useful for supplementing  the  command-line  op‐
34       tions when llvm-symbolizer is invoked by another program or runtime.
35

EXAMPLES

37       All of the following examples use the following two source files as in‐
38       put. They use a mixture of C-style and C++-style linkage to  illustrate
39       how these names are printed differently (see --demangle).
40
41          // test.h
42          extern "C" inline int foz() {
43            return 1234;
44          }
45
46          // test.cpp
47          #include "test.h"
48          int bar=42;
49
50          int foo() {
51            return bar;
52          }
53
54          int baz() {
55            volatile int k = 42;
56            return foz() + k;
57          }
58
59          int main() {
60            return foo() + baz();
61          }
62
63       These files are built as follows:
64
65          $ clang -g test.cpp -o test.elf
66          $ clang -g -O2 test.cpp -o inlined.elf
67
68       Example 1 - addresses and object on command-line:
69
70          $ llvm-symbolizer --obj=test.elf 0x4004d0 0x400490
71          foz
72          /tmp/test.h:1:0
73
74          baz()
75          /tmp/test.cpp:11:0
76
77       Example 2 - addresses on standard input:
78
79          $ cat addr.txt
80          0x4004a0
81          0x400490
82          0x4004d0
83          $ llvm-symbolizer --obj=test.elf < addr.txt
84          main
85          /tmp/test.cpp:15:0
86
87          baz()
88          /tmp/test.cpp:11:0
89
90          foz
91          /tmp/./test.h:1:0
92
93       Example 3 - object specified with address:
94
95          $ llvm-symbolizer "test.elf 0x400490" "inlined.elf 0x400480"
96          baz()
97          /tmp/test.cpp:11:0
98
99          foo()
100          /tmp/test.cpp:8:10
101
102          $ cat addr2.txt
103          test.elf 0x4004a0
104          inlined.elf 0x400480
105
106          $ llvm-symbolizer < addr2.txt
107          main
108          /tmp/test.cpp:15:0
109
110          foo()
111          /tmp/test.cpp:8:10
112
113       Example 4 - CODE and DATA prefixes:
114
115          $ llvm-symbolizer --obj=test.elf "CODE 0x400490" "DATA 0x601028"
116          baz()
117          /tmp/test.cpp:11:0
118
119          bar
120          6295592 4
121
122          $ cat addr3.txt
123          CODE test.elf 0x4004a0
124          DATA inlined.elf 0x601028
125
126          $ llvm-symbolizer < addr3.txt
127          main
128          /tmp/test.cpp:15:0
129
130          bar
131          6295592 4
132

OPTIONS

134       --adjust-vma <offset>
135              Add  the specified offset to object file addresses when perform‐
136              ing lookups.  This can be used to perform lookups as if the  ob‐
137              ject were relocated by the offset.
138
139       --basenames, -s
140              Strip directories when printing the file path.
141
142       --demangle, -C
143              Print  demangled  function names, if the names are mangled (e.g.
144              the mangled name _Z3bazv becomes baz(), whilst  the  non-mangled
145              name foz is printed as is). Defaults to true.
146
147       --dwp <path>
148              Use the specified DWP file at <path> for any CUs that have split
149              DWARF debug data.
150
151       --fallback-debug-path <path>
152              When a separate file contains debug data, and is referenced by a
153              GNU  debug  link  section, use the specified path as a basis for
154              locating the debug data if it cannot be found  relative  to  the
155              object.
156
157       --functions [<none|short|linkage>], -f
158              Specify  the way function names are printed (omit function name,
159              print short function name, or print full linkage  name,  respec‐
160              tively). Defaults to linkage.
161
162       --help, -h
163              Show help and usage for this command.
164
165       --help-list
166              Show  help  and  usage for this command without grouping the op‐
167              tions into categories.
168
169       --inlining, --inlines, -i
170              If a source code location is in an inlined function, prints  all
171              the inlined frames. Defaults to true.
172
173       --no-demangle
174              Don't print demangled function names.
175
176       --obj <path>, --exe, -e
177              Path  to  object  file to be symbolized. If - is specified, read
178              the object directly from the standard input stream.
179
180       --output-style <LLVM|GNU>
181              Specify the preferred output style. Defaults to LLVM.  When  the
182              output  style is set to GNU, the tool follows the style of GNU's
183              addr2line.  The differences from the LLVM style are:
184
185              • Does not print the column of a source code location.
186
187              • Does not add an empty line after the report for an address.
188
189              • Does not replace the name of an inlined function with the name
190                of  the  topmost  caller when inlined frames are not shown and
191                --use-symbol-table is on.
192
193                 $ llvm-symbolizer --obj=inlined.elf 0x4004be 0x400486 -p
194                 baz() at /tmp/test.cpp:11:18
195                  (inlined by) main at /tmp/test.cpp:15:0
196
197                 foo() at /tmp/test.cpp:6:3
198
199                 $ llvm-symbolizer --output-style=LLVM --obj=inlined.elf 0x4004be 0x400486 -p -i=0
200                 main at /tmp/test.cpp:11:18
201
202                 foo() at /tmp/test.cpp:6:3
203
204                 $ llvm-symbolizer --output-style=GNU --obj=inlined.elf 0x4004be 0x400486 -p -i=0
205                 baz() at /tmp/test.cpp:11
206                 foo() at /tmp/test.cpp:6
207
208       --pretty-print, -p
209              Print human readable output. If --inlining is specified, the en‐
210              closing scope is prefixed by (inlined by).
211
212          $ llvm-symbolizer --obj=inlined.elf 0x4004be --inlining --pretty-print
213          baz() at /tmp/test.cpp:11:18
214           (inlined by) main at /tmp/test.cpp:15:0
215
216       --print-address, --addresses, -a
217              Print  address  before  the  source  code  location. Defaults to
218              false.
219
220          $ llvm-symbolizer --obj=inlined.elf --print-address 0x4004be
221          0x4004be
222          baz()
223          /tmp/test.cpp:11:18
224          main
225          /tmp/test.cpp:15:0
226
227          $ llvm-symbolizer --obj=inlined.elf 0x4004be --pretty-print --print-address
228          0x4004be: baz() at /tmp/test.cpp:11:18
229           (inlined by) main at /tmp/test.cpp:15:0
230
231       --print-source-context-lines <N>
232              Print N lines of source context for each symbolized address.
233
234          $ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=2
235          baz()
236          /tmp/test.cpp:11:0
237          10  :   volatile int k = 42;
238          11 >:   return foz() + k;
239          12  : }
240
241       --use-symbol-table
242              Prefer function names stored in symbol table to  function  names
243              in debug info sections. Defaults to true.
244
245       --verbose
246              Print verbose line and column information.
247
248          $ llvm-symbolizer --obj=inlined.elf --verbose 0x4004be
249          baz()
250            Filename: /tmp/test.cpp
251          Function start line: 9
252            Line: 11
253            Column: 18
254          main
255            Filename: /tmp/test.cpp
256          Function start line: 14
257            Line: 15
258            Column: 0
259
260       --version
261              Print version information for the tool.
262
263       @<FILE>
264              Read command-line options from response file <FILE>.
265

MACH-O SPECIFIC OPTIONS

267       --default-arch <arch>
268              If  a  binary  contains  object files for multiple architectures
269              (e.g. it is a Mach-O universal  binary),  symbolize  the  object
270              file  for a given architecture.  You can also specify the archi‐
271              tecture by writing binary_name:arch_name in the input (see exam‐
272              ple  below). If the architecture is not specified in either way,
273              the address will not be symbolized. Defaults to empty string.
274
275          $ cat addr.txt
276          /tmp/mach_universal_binary:i386 0x1f84
277          /tmp/mach_universal_binary:x86_64 0x100000f24
278
279          $ llvm-symbolizer < addr.txt
280          _main
281          /tmp/source_i386.cc:8
282
283          _main
284          /tmp/source_x86_64.cc:8
285
286       --dsym-hint <path/to/file.dSYM>
287              If the debug info for a binary isn't present in the default  lo‐
288              cation,  look  for the debug info at the .dSYM path provided via
289              this option. This flag can be used multiple times.
290

EXIT STATUS

292       llvm-symbolizer returns 0. Other exit codes imply an  internal  program
293       error.
294

SEE ALSO

296       llvm-addr2line(1)
297

AUTHOR

299       Maintained by the LLVM Team (https://llvm.org/).
300
302       2003-2021, LLVM Project
303
304
305
306
30710                                2021-07-22                LLVM-SYMBOLIZER(1)
Impressum