Home

addr2line

addr2line is a command-line utility in the GNU binutils suite that converts program addresses into corresponding source code locations. It uses the DWARF debugging information embedded in an executable or core dump to determine the exact file name and line number where an instruction originates. This makes it useful for interpreting crash reports and stack traces.

Usage typically involves specifying the target executable with -e and listing one or more addresses to translate.

Common options include:

- -e to define the executable containing the debugging information

- -f to print the function names along with file and line

- -C to demangle C++ symbols

- -p to produce a more compact, one-line per address output that includes the address, function, and

- -a to annotate each address with its translated location

limitations and considerations:

- addr2line relies on DWARF debugging information; stripped binaries or those without debugging data will have limited

- When used with core dumps or crash reports, the addresses must correspond to code within the

Overall, addr2line is a lightweight tool for translating runtime addresses into human-readable source locations, aiding debugging

For
example,
addr2line
-e
myprogram
0x4005a3
0x4005b7
will
print
the
file
and
line
for
each
address.
The
tool
can
also
provide
function
names
when
combined
with
appropriate
options,
and
can
optionally
demangle
C++
names
for
readability.
location
or
no
line
information
and
may
only
yield
symbol
names
or
fail
to
resolve
locations.
provided
executable
and
relevant
binaries.
and
post-mortem
analysis.