1LLVM-SYMBOLIZER(1) LLVM LLVM-SYMBOLIZER(1)
2
3
4
6 llvm-symbolizer - convert addresses into source code locations
7
9 llvm-symbolizer [options] [addresses...]
10
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
32 All of the following examples use the following two source files as in‐
33 put. They use a mixture of C-style and C++-style linkage to illustrate
34 how these names are printed differently (see --demangle).
35
36 // test.h
37 extern "C" inline int foz() {
38 return 1234;
39 }
40
41 // test.cpp
42 #include "test.h"
43 int bar=42;
44
45 int foo() {
46 return bar;
47 }
48
49 int baz() {
50 volatile int k = 42;
51 return foz() + k;
52 }
53
54 int main() {
55 return foo() + baz();
56 }
57
58 These files are built as follows:
59
60 $ clang -g test.cpp -o test.elf
61 $ clang -g -O2 test.cpp -o inlined.elf
62
63 Example 1 - addresses and object on command-line:
64
65 $ llvm-symbolizer --obj=test.elf 0x4004d0 0x400490
66 foz
67 /tmp/test.h:1:0
68
69 baz()
70 /tmp/test.cpp:11:0
71
72 Example 2 - addresses on standard input:
73
74 $ cat addr.txt
75 0x4004a0
76 0x400490
77 0x4004d0
78 $ llvm-symbolizer --obj=test.elf < addr.txt
79 main
80 /tmp/test.cpp:15:0
81
82 baz()
83 /tmp/test.cpp:11:0
84
85 foz
86 /tmp/./test.h:1:0
87
88 Example 3 - object specified with address:
89
90 $ llvm-symbolizer "test.elf 0x400490" "inlined.elf 0x400480"
91 baz()
92 /tmp/test.cpp:11:0
93
94 foo()
95 /tmp/test.cpp:8:10
96
97 $ cat addr2.txt
98 test.elf 0x4004a0
99 inlined.elf 0x400480
100
101 $ llvm-symbolizer < addr2.txt
102 main
103 /tmp/test.cpp:15:0
104
105 foo()
106 /tmp/test.cpp:8:10
107
108 Example 4 - CODE and DATA prefixes:
109
110 $ llvm-symbolizer --obj=test.elf "CODE 0x400490" "DATA 0x601028"
111 baz()
112 /tmp/test.cpp:11:0
113
114 bar
115 6295592 4
116
117 $ cat addr3.txt
118 CODE test.elf 0x4004a0
119 DATA inlined.elf 0x601028
120
121 $ llvm-symbolizer < addr3.txt
122 main
123 /tmp/test.cpp:15:0
124
125 bar
126 6295592 4
127
129 --adjust-vma <offset>
130 Add the specified offset to object file addresses when perform‐
131 ing lookups. This can be used to perform lookups as if the ob‐
132 ject were relocated by the offset.
133
134 --basenames, -s
135 Strip directories when printing the file path.
136
137 --demangle, -C
138 Print demangled function names, if the names are mangled (e.g.
139 the mangled name _Z3bazv becomes baz(), whilst the non-mangled
140 name foz is printed as is). Defaults to true.
141
142 --dwp <path>
143 Use the specified DWP file at <path> for any CUs that have split
144 DWARF debug data.
145
146 --fallback-debug-path <path>
147 When a separate file contains debug data, and is referenced by a
148 GNU debug link section, use the specified path as a basis for
149 locating the debug data if it cannot be found relative to the
150 object.
151
152 --functions [<none|short|linkage>], -f
153 Specify the way function names are printed (omit function name,
154 print short function name, or print full linkage name, respec‐
155 tively). Defaults to linkage.
156
157 --help, -h
158 Show help and usage for this command.
159
160 --help-list
161 Show help and usage for this command without grouping the op‐
162 tions into categories.
163
164 --inlining, --inlines, -i
165 If a source code location is in an inlined function, prints all
166 the inlined frames. Defaults to true.
167
168 --no-demangle
169 Don't print demangled function names.
170
171 --obj <path>, --exe, -e
172 Path to object file to be symbolized. If - is specified, read
173 the object directly from the standard input stream.
174
175 --output-style <LLVM|GNU>
176 Specify the preferred output style. Defaults to LLVM. When the
177 output style is set to GNU, the tool follows the style of GNU's
178 addr2line. The differences from the LLVM style are:
179
180 • Does not print the column of a source code location.
181
182 • Does not add an empty line after the report for an address.
183
184 • Does not replace the name of an inlined function with the name
185 of the topmost caller when inlined frames are not shown and
186 --use-symbol-table is on.
187
188 $ llvm-symbolizer --obj=inlined.elf 0x4004be 0x400486 -p
189 baz() at /tmp/test.cpp:11:18
190 (inlined by) main at /tmp/test.cpp:15:0
191
192 foo() at /tmp/test.cpp:6:3
193
194 $ llvm-symbolizer --output-style=LLVM --obj=inlined.elf 0x4004be 0x400486 -p -i=0
195 main at /tmp/test.cpp:11:18
196
197 foo() at /tmp/test.cpp:6:3
198
199 $ llvm-symbolizer --output-style=GNU --obj=inlined.elf 0x4004be 0x400486 -p -i=0
200 baz() at /tmp/test.cpp:11
201 foo() at /tmp/test.cpp:6
202
203 --pretty-print, -p
204 Print human readable output. If --inlining is specified, the en‐
205 closing scope is prefixed by (inlined by).
206
207 $ llvm-symbolizer --obj=inlined.elf 0x4004be --inlining --pretty-print
208 baz() at /tmp/test.cpp:11:18
209 (inlined by) main at /tmp/test.cpp:15:0
210
211 --print-address, --addresses, -a
212 Print address before the source code location. Defaults to
213 false.
214
215 $ llvm-symbolizer --obj=inlined.elf --print-address 0x4004be
216 0x4004be
217 baz()
218 /tmp/test.cpp:11:18
219 main
220 /tmp/test.cpp:15:0
221
222 $ llvm-symbolizer --obj=inlined.elf 0x4004be --pretty-print --print-address
223 0x4004be: baz() at /tmp/test.cpp:11:18
224 (inlined by) main at /tmp/test.cpp:15:0
225
226 --print-source-context-lines <N>
227 Print N lines of source context for each symbolized address.
228
229 $ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=2
230 baz()
231 /tmp/test.cpp:11:0
232 10 : volatile int k = 42;
233 11 >: return foz() + k;
234 12 : }
235
236 --use-symbol-table
237 Prefer function names stored in symbol table to function names
238 in debug info sections. Defaults to true.
239
240 --verbose
241 Print verbose line and column information.
242
243 $ llvm-symbolizer --obj=inlined.elf --verbose 0x4004be
244 baz()
245 Filename: /tmp/test.cpp
246 Function start line: 9
247 Line: 11
248 Column: 18
249 main
250 Filename: /tmp/test.cpp
251 Function start line: 14
252 Line: 15
253 Column: 0
254
255 --version
256 Print version information for the tool.
257
258 @<FILE>
259 Read command-line options from response file <FILE>.
260
262 --default-arch <arch>
263 If a binary contains object files for multiple architectures
264 (e.g. it is a Mach-O universal binary), symbolize the object
265 file for a given architecture. You can also specify the archi‐
266 tecture by writing binary_name:arch_name in the input (see exam‐
267 ple below). If the architecture is not specified in either way,
268 the address will not be symbolized. Defaults to empty string.
269
270 $ cat addr.txt
271 /tmp/mach_universal_binary:i386 0x1f84
272 /tmp/mach_universal_binary:x86_64 0x100000f24
273
274 $ llvm-symbolizer < addr.txt
275 _main
276 /tmp/source_i386.cc:8
277
278 _main
279 /tmp/source_x86_64.cc:8
280
281 --dsym-hint <path/to/file.dSYM>
282 If the debug info for a binary isn't present in the default lo‐
283 cation, look for the debug info at the .dSYM path provided via
284 this option. This flag can be used multiple times.
285
287 llvm-symbolizer returns 0. Other exit codes imply an internal program
288 error.
289
291 llvm-addr2line(1)
292
294 Maintained by the LLVM Team (https://llvm.org/).
295
297 2003-2021, LLVM Project
298
299
300
301
3029 2021-07-22 LLVM-SYMBOLIZER(1)