2 .\" Man page generated from reStructuredText.
5 .nr rst2man-indent-level 0
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17 .\" .rstReportMargin pre:
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
31 .TH "LLVM-SYMBOLIZER" "1" "2021-06-07" "12" "LLVM"
33 llvm-symbolizer \- convert addresses into source code locations
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
215 Example 5 \- path\-style options:
217 This example uses the same source file as above, but the source file\(aqs
218 full path is /tmp/foo/test.cpp and is compiled as follows. The first case
219 shows the default absolute path, the second \-\-basenames, and the third
220 shows \-\-relativenames.
228 $ clang \-g foo/test.cpp \-o test.elf
229 $ llvm\-symbolizer \-\-obj=test.elf 0x4004a0
231 /tmp/foo/test.cpp:15:0
232 $ llvm\-symbolizer \-\-obj=test.elf 0x4004a0 \-\-basenames
235 $ llvm\-symbolizer \-\-obj=test.elf 0x4004a0 \-\-relativenames
245 .B \-\-adjust\-vma <offset>
246 Add the specified offset to object file addresses when performing lookups.
247 This can be used to perform lookups as if the object were relocated by the
252 .B \-\-basenames, \-s
253 Print just the file\(aqs name without any directories, instead of the
259 Print demangled function names, if the names are mangled (e.g. the mangled
260 name \fI_Z3bazv\fP becomes \fIbaz()\fP, whilst the non\-mangled name \fIfoz\fP is printed
261 as is). Defaults to true.
266 Use the specified DWP file at \fB<path>\fP for any CUs that have split DWARF
271 .B \-\-fallback\-debug\-path <path>
272 When a separate file contains debug data, and is referenced by a GNU debug
273 link section, use the specified path as a basis for locating the debug data if
274 it cannot be found relative to the object.
278 .B \-\-functions [=<none|short|linkage>], \-f
279 Specify the way function names are printed (omit function name, print short
280 function name, or print full linkage name, respectively). Defaults to
286 Show help and usage for this command.
290 .B \-\-inlining, \-\-inlines, \-i
291 If a source code location is in an inlined function, prints all the inlined
292 frames. This is the default.
297 Don\(aqt print inlined frames.
302 Don\(aqt print demangled function names.
306 .B \-\-obj <path>, \-\-exe, \-e
307 Path to object file to be symbolized. If \fB\-\fP is specified, read the object
308 directly from the standard input stream.
312 .B \-\-output\-style <LLVM|GNU>
313 Specify the preferred output style. Defaults to \fBLLVM\fP\&. When the output
314 style is set to \fBGNU\fP, the tool follows the style of GNU\(aqs \fBaddr2line\fP\&.
315 The differences from the \fBLLVM\fP style are:
318 Does not print the column of a source code location.
320 Does not add an empty line after the report for an address.
322 Does not replace the name of an inlined function with the name of the
323 topmost caller when inlined frames are not shown and \fI\%\-\-use\-symbol\-table\fP
326 Prints an address\(aqs debug\-data discriminator when it is non\-zero. One way to
327 produce discriminators is to compile with clang\(aqs \-fdebug\-info\-for\-profiling.
334 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be 0x400486 \-p
335 baz() at /tmp/test.cpp:11:18
336 (inlined by) main at /tmp/test.cpp:15:0
338 foo() at /tmp/test.cpp:6:3
340 $ llvm\-symbolizer \-\-output\-style=LLVM \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-\-no\-inlines
341 main at /tmp/test.cpp:11:18
343 foo() at /tmp/test.cpp:6:3
345 $ llvm\-symbolizer \-\-output\-style=GNU \-\-obj=inlined.elf 0x4004be 0x400486 \-p \-\-no\-inlines
346 baz() at /tmp/test.cpp:11
347 foo() at /tmp/test.cpp:6
349 $ clang \-g \-fdebug\-info\-for\-profiling test.cpp \-o profiling.elf
350 $ llvm\-symbolizer \-\-output\-style=GNU \-\-obj=profiling.elf 0x401167 \-p \-\-no\-inlines
351 main at /tmp/test.cpp:15 (discriminator 2)
359 .B \-\-pretty\-print, \-p
360 Print human readable output. If \fI\%\-\-inlining\fP is specified, the
361 enclosing scope is prefixed by (inlined by).
367 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-inlining \-\-pretty\-print
368 baz() at /tmp/test.cpp:11:18
369 (inlined by) main at /tmp/test.cpp:15:0
377 .B \-\-print\-address, \-\-addresses, \-a
378 Print address before the source code location. Defaults to false.
384 $ llvm\-symbolizer \-\-obj=inlined.elf \-\-print\-address 0x4004be
391 $ llvm\-symbolizer \-\-obj=inlined.elf 0x4004be \-\-pretty\-print \-\-print\-address
392 0x4004be: baz() at /tmp/test.cpp:11:18
393 (inlined by) main at /tmp/test.cpp:15:0
401 .B \-\-print\-source\-context\-lines <N>
402 Print \fBN\fP lines of source context for each symbolized address.
408 $ llvm\-symbolizer \-\-obj=test.elf 0x400490 \-\-print\-source\-context\-lines=2
411 10 : volatile int k = 42;
412 11 >: return foz() + k;
422 Print the file\(aqs path relative to the compilation directory, instead
423 of the absolute path. If the command\-line to the compiler included
424 the full path, this will be the same as the default.
428 .B \-\-use\-symbol\-table
429 Prefer function names stored in symbol table to function names in debug info
430 sections. Defaults to true.
435 Print verbose line and column information.
441 $ llvm\-symbolizer \-\-obj=inlined.elf \-\-verbose 0x4004be
443 Filename: /tmp/test.cpp
444 Function start line: 9
448 Filename: /tmp/test.cpp
449 Function start line: 14
460 Print version information for the tool.
465 Read command\-line options from response file \fI<FILE>\fP\&.
467 .SH WINDOWS/PDB SPECIFIC OPTIONS
471 Use the Windows DIA SDK for symbolization. If the DIA SDK is not found,
472 llvm\-symbolizer will fall back to the native implementation.
474 .SH MACH-O SPECIFIC OPTIONS
477 .B \-\-default\-arch <arch>
478 If a binary contains object files for multiple architectures (e.g. it is a
479 Mach\-O universal binary), symbolize the object file for a given architecture.
480 You can also specify the architecture by writing \fBbinary_name:arch_name\fP in
481 the input (see example below). If the architecture is not specified in either
482 way, the address will not be symbolized. Defaults to empty string.
489 /tmp/mach_universal_binary:i386 0x1f84
490 /tmp/mach_universal_binary:x86_64 0x100000f24
492 $ llvm\-symbolizer < addr.txt
494 /tmp/source_i386.cc:8
497 /tmp/source_x86_64.cc:8
505 .B \-\-dsym\-hint <path/to/file.dSYM>
506 If the debug info for a binary isn\(aqt present in the default location, look for
507 the debug info at the .dSYM path provided via this option. This flag can be
512 \fBllvm\-symbolizer\fP returns 0. Other exit codes imply an internal program
516 \fBllvm\-addr2line(1)\fP
518 Maintained by the LLVM Team (https://llvm.org/).
520 2003-2021, LLVM Project
521 .\" Generated by docutils manpage writer.