LLVM-SYMBOLIZER(1)
π NAME π
okay bestie, meet llvm-symbolizer β she converts addresses into source code locations. That's the whole vibe. π
β¨ SYNOPSIS β¨
llvm-symbolizer [options] [addresses...]
π¦ DESCRIPTION π¦
llvm-symbolizer reads input names and addresses from the command-line and prints the matching source code locations to standard output. She can also symbolize logs containing Symbolizer Markup via --filter-markup. Addresses may be specified as numbers or symbol names, no cap. β¨
If no address is specified on the command-line, she reads the addresses from standard input. If no input name is specified on the command-line, but addresses are, the first address value is treated as an input name. If an input value is not recognized, she reports that source information is not found. Simple. π«Ά
Input names can be specified together with the addresses either on standard input or as positional arguments on the command-line. By default, input names are interpreted as object file paths. However, prefixing a name with BUILDID: states that it is a hex build ID rather than a path. This will look up the corresponding debug binary. For consistency, prefixing a name with FILE: explicitly states that it is an object file path (the default). πΈ
A positional argument or standard input value can be preceded by "DATA" or "CODE" to indicate that the address should be symbolized as data or executable code respectively. If neither is specified, "CODE" is assumed. DATA is symbolized as address and symbol size rather than line number. π₯
llvm-symbolizer parses options from the environment variable LLVM_SYMBOLIZER_OPTS after parsing options from the command line. LLVM_SYMBOLIZER_OPTS is primarily useful for supplementing the command-line options when llvm-symbolizer is invoked by another program or runtime. π
π EXAMPLES π
All of the following examples use the following two source files as input. They use a mixture of C-style and C++-style linkage to illustrate how these names are printed differently (see --demangle).
// test.h
extern "C" inline int foz() {
return 1234;
}
// test.cpp
#include "test.h"
int bar=42;
int foo() {
return bar;
}
int baz() {
volatile int k = 42;
return foz() + k;
}
int main() {
return foo() + baz();
}
These files are built as follows:
$ clang -g test.cpp -o test.elf
$ clang -g -O2 test.cpp -o inlined.elf
π Example 1 β addresses and object on command-line π
$ llvm-symbolizer --obj=test.elf 0x4004d0 0x400490
foz
/tmp/test.h:1:0
baz()
/tmp/test.cpp:11:0
π Example 2 β addresses on standard input π
$ cat addr.txt
0x4004a0
0x400490
0x4004d0
$ llvm-symbolizer --obj=test.elf < addr.txt
main
/tmp/test.cpp:15:0
baz()
/tmp/test.cpp:11:0
foz
/tmp/./test.h:1:0
π Example 3 β object specified with address π
$ llvm-symbolizer "test.elf 0x400490" "FILE:inlined.elf 0x400480"
baz()
/tmp/test.cpp:11:0
foo()
/tmp/test.cpp:8:10
$ cat addr2.txt
FILE:test.elf 0x4004a0
inlined.elf 0x400480
$ llvm-symbolizer < addr2.txt
main
/tmp/test.cpp:15:0
foo()
/tmp/test.cpp:8:10
π Example 4 β BUILDID and FILE prefixes π
$ llvm-symbolizer "FILE:test.elf 0x400490" "DATA BUILDID:123456789abcdef 0x601028"
baz()
/tmp/test.cpp:11:0
bar
6295592 4
$ cat addr3.txt
FILE:test.elf 0x400490
DATA BUILDID:123456789abcdef 0x601028
$ llvm-symbolizer < addr3.txt
baz()
/tmp/test.cpp:11:0
bar
6295592 4
π Example 5 β CODE and DATA prefixes π
$ llvm-symbolizer --obj=test.elf "CODE 0x400490" "DATA 0x601028"
baz()
/tmp/test.cpp:11:0
bar
6295592 4
$ cat addr4.txt
CODE test.elf 0x4004a0
DATA inlined.elf 0x601028
$ llvm-symbolizer < addr4.txt
main
/tmp/test.cpp:15:0
bar
6295592 4
π Example 6 β path-style options π
This example uses the same source file as above, but the source file's full path is /tmp/foo/test.cpp and is compiled as follows. The first case shows the default absolute path, the second --basenames, and the third shows --relativenames.
$ pwd
/tmp
$ clang -g foo/test.cpp -o test.elf
$ llvm-symbolizer --obj=test.elf 0x4004a0
main
/tmp/foo/test.cpp:15:0
$ llvm-symbolizer --obj=test.elf 0x4004a0 --basenames
main
test.cpp:15:0
$ llvm-symbolizer --obj=test.elf 0x4004a0 --relativenames
main
foo/test.cpp:15:0
π Example 7 β Addresses as symbol names π
$ llvm-symbolizer --obj=test.elf main
main
/tmp/test.cpp:14:0
$ llvm-symbolizer --obj=test.elf "CODE foz"
foz
/tmp/test.h:1:0
π Example 8 β --skip-line-zero output for an address with no line correspondence (an address associated with line zero) π
// test.c
int foo = 0;
int x = 1234;
int main() {
if (x)
return foo;
else
return x;
}
These files are built as follows:
$ clang -g -O2 -S test.c -o test.s
$ llvm-mc -filetype=obj -triple=x86_64-unknown-linux test.s -o test.o
$ llvm-symbolizer --obj=test.o --skip-line-zero 0xa
main
/tmp/test.c:5:7 (approximate)
β¨ OPTIONS β¨
okay bestie, buckle up β this is the whole flag buffet, every single one, no skips. π
--adjust-vma <offset>β adds offset to object file addresses while it's doing lookups. it's giving "pretend the object got relocated by this offset" energy, so you can do your lookups as if that relocation already happened. π¦--skip-line-zeroβ if an address has no associated line number, it uses the last line number from the current sequence in the line-table instead. those lines get labeled "approximate" in the output, because ngl they might be misleading. π--basenames,-sβ prints just the file's name with no directories at all, instead of the absolute path. lowkey the glow-up from the whole path to justfile.c. β¨--build-idβ looks up the object using the given build ID, which you hand over as a hexadecimal string. mutually exclusive with--objβ pick one, bestie, you literally cannot have both. π--color [=<always|auto|never>]β says whether to use color in--filter-markupmode. defaults toauto, which sniffs out whether standard output supports color. and just writing--coloralone is exactly the same as--color=always. π--debug-file-directory <path>β gives a path to a directory that has a.build-idsubdirectory, so it can go hunting for debug info for stripped binaries. if you pass this argument more than once, they get searched in the order you gave them. π§--debuginfod,--no-debuginfodβ whether or not to try debuginfod lookups for debug binaries. unless you say otherwise, debuginfod is only enabled if libcurl was compiled in (LLVM_ENABLE_CURL) and at least one server URL was provided by the environment variableDEBUGINFOD_URLS. π--demangle,-Cβ prints demangled function names if the names are mangled (so the mangled name_Z3bazvbecomesbaz(), while the non-mangled namefozgets printed just as it is). defaults to true. β¨--dwp <path>β uses the DWP file at path for any CUs that have split DWARF debug data. π--fallback-debug-path <path>β when a separate file contains debug data and it's referenced by a GNU debug link section, this path is used as a basis for locating that debug data if it can't be found relative to the object. π¦--filter-markupβ reads from standard input, converts the Symbolizer Markup it finds into human-readable form, and prints the results to standard output. heads up, these markup elements are not yet supported:{{{hexdict}}}{{{dumpfile}}}
the {{{bt}}} backtrace element reports frames using this syntax:
#<number>[.<inline>] <address> <function> <file>:<line>:<col>
(<module>+<relative address>)
<inline> provides frame numbers for calls that got inlined into the caller corresponding to <number>. those inlined call numbers start at 1 and go up from callee to caller. <address> is an address inside the call instruction to the function β and bestie, note that it may not be the start of the instruction. <relative address> is the corresponding virtual offset in the <module> loaded at that address. π
--functions [=<none|short|linkage>],-fβ picks how function names get printed (omit the function name, print the short function name, or print the full linkage name, respectively). defaults tolinkage. π--help,-hβ shows help and usage for this command. π«Ά--inlining,--inlines,-iβ if a source code location is inside an inlined function, prints all the inlined frames. this is the default, so you're already slaying. π--no-inlinesβ doesn't print inlined frames. π--no-demangleβ doesn't print demangled function names. π--obj <path>,--exe,-eβ path to the object file to be symbolized. if you pass-, it reads the object directly from the standard input stream. mutually exclusive with--build-id. π₯--output-style <LLVM|GNU|JSON>β picks your preferred output style, defaults toLLVM. when it's set toGNU, the tool follows the style of GNU'saddr2line. the differences from the LLVM style are:- it does not print the column of a source code location.
- it does not add an empty line after the report for an address.
- it does not replace the name of an inlined function with the name of the topmost caller when inlined frames aren't shown.
- it prints an address's debug-data discriminator when it's non-zero. one way to produce discriminators is to compile with clang's
-fdebug-info-for-profiling.
JSON style gives you machine readable output in JSON. if addresses are supplied via stdin, the output JSON will be a series of individual objects. otherwise, all results will be contained in a single array. πΈ
$ llvm-symbolizer --obj=inlined.elf 0x4004be 0x400486 -p
baz() at /tmp/test.cpp:11:18
(inlined by) main at /tmp/test.cpp:15:0
foo() at /tmp/test.cpp:6:3
$ llvm-symbolizer --output-style=LLVM --obj=inlined.elf 0x4004be 0x400486 -p --no-inlines
main at /tmp/test.cpp:11:18
foo() at /tmp/test.cpp:6:3
$ llvm-symbolizer --output-style=GNU --obj=inlined.elf 0x4004be 0x400486 -p --no-inlines
baz() at /tmp/test.cpp:11
foo() at /tmp/test.cpp:6
$ clang -g -fdebug-info-for-profiling test.cpp -o profiling.elf
$ llvm-symbolizer --output-style=GNU --obj=profiling.elf 0x401167 -p --no-inlines
main at /tmp/test.cpp:15 (discriminator 2)
$ llvm-symbolizer --output-style=JSON --obj=inlined.elf 0x4004be 0x400486 -p
[
{
"Address": "0x4004be",
"ModuleName": "inlined.elf",
"Symbol": [
{
"Column": 18,
"Discriminator": 0,
"FileName": "/tmp/test.cpp",
"FunctionName": "baz()",
"Line": 11,
"StartAddress": "0x4004be",
"StartFileName": "/tmp/test.cpp",
"StartLine": 9
},
{
"Column": 0,
"Discriminator": 0,
"FileName": "/tmp/test.cpp",
"FunctionName": "main",
"Line": 15,
"StartAddress": "0x4004be",
"StartFileName": "/tmp/test.cpp",
"StartLine": 14
}
]
},
{
"Address": "0x400486",
"ModuleName": "inlined.elf",
"Symbol": [
{
"Column": 3,
"Discriminator": 0,
"FileName": "/tmp/test.cpp",
"FunctionName": "foo()",
"Line": 6,
"StartAddress": "0x400486",
"StartFileName": "/tmp/test.cpp",
"StartLine": 5
}
]
}
]
--pretty-print,-pβ prints human readable output. if--inliningis specified, the enclosing scope gets prefixed with(inlined by). for JSON output, this option makes the JSON indented and split over new lines β otherwise the JSON output gets printed in a compact form. π
$ llvm-symbolizer --obj=inlined.elf 0x4004be --inlining --pretty-print
baz() at /tmp/test.cpp:11:18
(inlined by) main at /tmp/test.cpp:15:0
--print-address,--addresses,-aβ prints the address before the source code location. defaults to false. π
$ llvm-symbolizer --obj=inlined.elf --print-address 0x4004be
0x4004be
baz()
/tmp/test.cpp:11:18
main
/tmp/test.cpp:15:0
$ llvm-symbolizer --obj=inlined.elf 0x4004be --pretty-print --print-address
0x4004be: baz() at /tmp/test.cpp:11:18
(inlined by) main at /tmp/test.cpp:15:0
--print-source-context-lines <N>β prints N lines of source context for each symbolized address. so much context, iconic. π₯
$ llvm-symbolizer --obj=test.elf 0x400490 --print-source-context-lines=3
baz()
/tmp/test.cpp:11:0
10 : volatile int k = 42;
11 >: return foz() + k;
12 : }
--relativenamesβ prints the file's path relative to the compilation directory, instead of the absolute path. if the command-line to the compiler included the full path, this will be the same as the default. π¦--verboseβ prints verbose address, line and column information. it's giving main character energy with all the deets. π
$ llvm-symbolizer --obj=inlined.elf --verbose 0x4004be
baz()
Filename: /tmp/test.cpp
Function start filename: /tmp/test.cpp
Function start line: 9
Function start address: 0x4004b6
Line: 11
Column: 18
main
Filename: /tmp/test.cpp
Function start filename: /tmp/test.cpp
Function start line: 14
Function start address: 0x4004b0
Line: 15
Column: 18
--version,-vβ prints version information for the tool. β¨@<FILE>β reads command-line options from the response file FILE. π«Ά
π» WINDOWS/PDB SPECIFIC OPTIONS π»
--diaβ uses the Windows DIA SDK for symbolization. if the DIA SDK isn't found,llvm-symbolizerwill fall back to the native implementation. no cap. π¦
π MACH-O SPECIFIC OPTIONS π
--default-arch <arch>β if a binary contains object files for multiple architectures (like, say, it's a Mach-O universal binary), symbolize the object file for the given architecture. you can also specify the architecture by writingbinary_name:arch_namein the input (see the example below, bestie). if the architecture isn't specified in either way, the address will not be symbolized. defaults to empty string. π
$ cat addr.txt
/tmp/mach_universal_binary:i386 0x1f84
/tmp/mach_universal_binary:x86_64 0x100000f24
$ llvm-symbolizer < addr.txt
_main
/tmp/source_i386.cc:8
_main
/tmp/source_x86_64.cc:8
--dsym-hint <path/to/file.dSYM>β if the debug info for a binary isn't sitting in the default location, go look for it at the.dSYMpath you gave via this option. this flag can be used multiple times, so stack 'em up. π
πͺ EXIT STATUS πͺ
llvm-symbolizer returns 0. any other exit codes imply an internal program error β so if you see one, that's a genuine π moment, not a you problem.
π SEE ALSO π
π AUTHOR π
So likeβ¦ who even maintains this masterpiece? Bestie, it's the whole LLVM Team β the group chat that never sleeps. They're the ones keeping this page cute and current, and you can find them living their best life over at https://llvm.org/. Go say hi, they're literally the main characters of compiler infrastructure. π
πΈ COPYRIGHT πΈ
All the legal-ish vibes, no cap:
2003-2025, LLVM Project
That's a whole two-decade glow-up, bestie. Respect. π«Ά
and that's the whole page, we're done, go symbolicate something iconic β¨
This was LLVM-SYMBOLIZER(1), source/version 20, dated 2025-09-03. Periodt. π ππ¦
π¦ where this page comes from
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms