2 .\" Man page generated from reStructuredText.
4 .TH "LLVM-SYMBOLIZER" "1" "2020-06-26" "10" "LLVM"
6 llvm-symbolizer \- convert addresses into source code locations
8 .nr rst2man-indent-level 0
12 level \\n[rst2man-indent-level]
13 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
20 .\" .rstReportMargin pre:
22 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
23 . nr rst2man-indent-level +1
24 .\" .rstReportMargin post:
28 .\" indent \\n[an-margin]
29 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
30 .nr rst2man-indent-level -1
31 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
32 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
36 \fBllvm\-symbolizer\fP [\fIoptions\fP] [\fIaddresses...\fP]
39 \fBllvm\-symbolizer\fP reads object file names and addresses from the
40 command\-line and prints corresponding source code locations to standard output.
42 If no address is specified on the command\-line, it reads the addresses from
43 standard input. If no object file is specified on the command\-line, but
44 addresses are, or if at any time an input value is not recognized, the input is
45 simply echoed to the output.
47 A positional argument or standard input value can be preceded by "DATA" or
48 "CODE" to indicate that the address should be symbolized as data or executable
49 code respectively. If neither is specified, "CODE" is assumed. DATA is
50 symbolized as address and symbol size rather than line number.
52 Object files can be specified together with the addresses either on standard
53 input or as positional arguments on the command\-line, following any "DATA" or
56 \fBllvm\-symbolizer\fP parses options from the environment variable
57 \fBLLVM_SYMBOLIZER_OPTS\fP after parsing options from the command line.
58 \fBLLVM_SYMBOLIZER_OPTS\fP is primarily useful for supplementing the command\-line
59 options when \fBllvm\-symbolizer\fP is invoked by another program or
63 All of the following examples use the following two source files as input. They
64 use a mixture of C\-style and C++\-style linkage to illustrate how these names are
65 printed differently (see \fI\%\-\-demangle\fP).
72 extern "C" inline int foz() {
105 These files are built as follows:
111 $ clang \-g test.cpp \-o test.elf
112 $ clang \-g \-O2 test.cpp \-o inlined.elf
118 Example 1 \- addresses and object on command\-line:
124 $ llvm\-symbolizer \-\-obj=test.elf 0x4004d0 0x400490
135 Example 2 \- addresses on standard input:
145 $ llvm\-symbolizer \-\-obj=test.elf < addr.txt
159 Example 3 \- object specified with address:
165 $ llvm\-symbolizer "test.elf 0x400490" "inlined.elf 0x400480"
176 $ llvm\-symbolizer < addr2.txt
187 Example 4 \- CODE and DATA prefixes:
193 $ llvm\-symbolizer \-\-obj=test.elf "CODE 0x400490" "DATA 0x601028"
201 CODE test.elf 0x4004a0
202 DATA inlined.elf 0x601028
204 $ llvm\-symbolizer < addr3.txt
217 .B \-\-adjust\-vma <offset>
218 Add the specified offset to object file addresses when performing lookups.
219 This can be used to perform lookups as if the object were relocated by the
224 .B \-\-basenames, \-s
225 Strip directories when printing the file path.
230 Print demangled function names, if the names are mangled (e.g. the mangled
231 name \fI_Z3bazv\fP becomes \fIbaz()\fP, whilst the non\-mangled name \fIfoz\fP is printed
232 as is). Defaults to true.
237 Use the specified DWP file at \fB<path>\fP for any CUs that have split DWARF
242 .B \-\-fallback\-debug\-path <path>
243 When a separate file contains debug data, and is referenced by a GNU debug
244 link section, use the specified path as a basis for locating the debug data if
245 it cannot be found relative to the object.
249 .B \-\-functions [<none|short|linkage>], \-f
250 Specify the way function names are printed (omit function name, print short
251 function name, or print full linkage name, respectively). Defaults to
257 Show help and usage for this command.
262 Show help and usage for this command without grouping the options into categories.
266 .B \-\-inlining, \-\-inlines, \-i
267 If a source code location is in an inlined function, prints all the inlined
268 frames. Defaults to true.
273 Don\(aqt print demangled function names.
277 .B \-\-obj <path>, \-\-exe, \-e
278 Path to object file to be symbolized. If \fB\-\fP is specified, read the object
279 directly from the standard input stream.
283 .B \-\-output\-style <LLVM|GNU>
284 Specify the preferred output style. Defaults to \fBLLVM\fP\&. When the output
285 style is set to \fBGNU\fP, the tool follows the style of GNU\(aqs \fBaddr2line\fP\&.
286 The differences from the \fBLLVM\fP style are:
289 Does not print the column of a source code location.
291 Does not add an empty line after the report for an address.
293 Does not replace the name of an inlined function with the name of the
294 topmost caller when inlined frames are not shown and \fI\%\-\-use\-symbol\-table\fP
302 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be 0x400486 \-p
303 baz() at /tmp/test.cpp:11:18
304 (inlined by) main at /tmp/test.cpp:15:0
306 foo() at /tmp/test.cpp:6:3
308 $ llvm\-symbolizer \-\-output\-style=LLVM \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-i=0
309 main at /tmp/test.cpp:11:18
311 foo() at /tmp/test.cpp:6:3
313 $ llvm\-symbolizer \-\-output\-style=GNU \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-i=0
314 baz() at /tmp/test.cpp:11
315 foo() at /tmp/test.cpp:6
323 .B \-\-pretty\-print, \-p
324 Print human readable output. If \fI\%\-\-inlining\fP is specified, the
325 enclosing scope is prefixed by (inlined by).
332 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-inlining \-\-pretty\-print
333 baz() at /tmp/test.cpp:11:18
334 (inlined by) main at /tmp/test.cpp:15:0
341 .B \-\-print\-address, \-\-addresses, \-a
342 Print address before the source code location. Defaults to false.
349 $ llvm\-symbolizer \-\-obj=inlined.elf \-\-print\-address 0x4004be
356 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-pretty\-print \-\-print\-address
357 0x4004be: baz() at /tmp/test.cpp:11:18
358 (inlined by) main at /tmp/test.cpp:15:0
365 .B \-\-print\-source\-context\-lines <N>
366 Print \fBN\fP lines of source context for each symbolized address.
373 $ llvm\-symbolizer \-\-obj=test.elf 0x400490 \-\-print\-source\-context\-lines=2
376 10 : volatile int k = 42;
377 11 >: return foz() + k;
385 .B \-\-use\-symbol\-table
386 Prefer function names stored in symbol table to function names in debug info
387 sections. Defaults to true.
392 Print verbose line and column information.
399 $ llvm\-symbolizer \-\-obj=inlined.elf \-\-verbose 0x4004be
401 Filename: /tmp/test.cpp
402 Function start line: 9
406 Filename: /tmp/test.cpp
407 Function start line: 14
417 Print version information for the tool.
422 Read command\-line options from response file \fI<FILE>\fP\&.
424 .SH MACH-O SPECIFIC OPTIONS
427 .B \-\-default\-arch <arch>
428 If a binary contains object files for multiple architectures (e.g. it is a
429 Mach\-O universal binary), symbolize the object file for a given architecture.
430 You can also specify the architecture by writing \fBbinary_name:arch_name\fP in
431 the input (see example below). If the architecture is not specified in either
432 way, the address will not be symbolized. Defaults to empty string.
440 /tmp/mach_universal_binary:i386 0x1f84
441 /tmp/mach_universal_binary:x86_64 0x100000f24
443 $ llvm\-symbolizer < addr.txt
445 /tmp/source_i386.cc:8
448 /tmp/source_x86_64.cc:8
455 .B \-\-dsym\-hint <path/to/file.dSYM>
456 If the debug info for a binary isn\(aqt present in the default location, look for
457 the debug info at the .dSYM path provided via this option. This flag can be
462 \fBllvm\-symbolizer\fP returns 0. Other exit codes imply an internal program
466 \fBllvm\-addr2line(1)\fP
468 Maintained by the LLVM Team (https://llvm.org/).
470 2003-2020, LLVM Project
471 .\" Generated by docutils manpage writer.