Skip to content
Latchkey

addr2line: Usage, Options & Common CI Errors

addr2line turns a hex address in a binary into a source file and line number.

addr2line is how you decode a bare-address crash backtrace from CI into real file:line locations. It needs the unstripped binary (or its .debug file) built with -g, which is why release symbolication depends on the split-debug workflow.

What it does

addr2line translates program addresses into source file names and line numbers using the DWARF debug information in a binary. Given a crash address from a backtrace, it tells you which line of which file that address corresponds to.

Common usage

Terminal
addr2line -e app 0x401136
addr2line -f -C -e app 0x401136        # also print the function
addr2line -e app.debug 0x401136        # use the split debug file
addr2line -p -f -e app 0x401136 0x4011a0   # multiple addresses
nm app | grep main   # find an address to test

Options

FlagWhat it does
-e <file>The executable/object to look up in
-fAlso show the function name
-CDemangle C++ names
-pPretty, one line per address
-iShow inlined frames too

Common errors in CI

addr2line printing "??:0" or "??:?" means there is no debug info for that address - the binary was stripped or built without -g; point -e at the .debug file instead. The addresses must match the same binary that crashed; an address from a PIE/ASLR run is a runtime address, so subtract the load base first (or use addresses relative to the binary). Cross-arch binaries need the target-prefixed addr2line.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →