addr2line —
translate program addresses to source file names
and line numbers
addr2line |
[-a |
--addresses]
[-b
target |
--target=target]
[-e
pathname |
--exe=pathname]
[-f |
--functions]
[-i |
--inlines]
[-j
sectionname |
--section=sectionname]
[-p |
--pretty-print]
[-s |
--basename]
[-C |
--demangle]
[-H |
--help]
[-V |
--version]
[hexaddress...] |
The
addr2line utility translates program addresses
specified by the command line arguments
hexaddress to their corresponding source file
names and line numbers. If no arguments are given to
addr2line, it will read these addresses from
standard input.
Program addresses specified by arguments
hexaddress are encoded using the conventions
accepted by
strtoull(3).
By default,
addr2line will use the executable
“
a.out”. The
-e option may be used to specified a different
ELF object.
The
addr2line utility recognizes the following
options:
-
-
- -a
|
--addresses
- Display the address prior to the line number
information.
-
-
- -b
target |
--target=target
- This option is recognized by
addr2line but is ignored. It is supported for
compatibility with GNU binutils.
-
-
- -e
pathname |
--exe=pathname
- Use the ELF object specified by argument
pathname to translate addresses. If this
option is not specified, addr2line will use
the file “a.out”.
-
-
- -f
|
--functions
- Display function names in addition to file and line number
information.
-
-
- -i
|
--inlines
- If the address specified belongs to an inlined function,
also display the line number information for its caller, recursively until
the first non-inlined caller.
-
-
- -j
sectionname |
--section=sectionname
- The values specified by arguments
hexaddress are to be treated as offsets
into the section named sectionname.
-
-
- -p
|
--pretty-print
- Display the line number information on one line, in human
readable manner.
-
-
- -s
|
--basename
- Display only the base name for each file name.
-
-
- -C
|
--demangle
- Demangle C++ names.
-
-
- -H
|
--help
- Print a help message.
-
-
- -V
|
--version
- Print a version identifier and exit.
If the
-f option was not specified,
addr2line will print the file name and line
number for each address specified on a separate line.
If the
-f option was specified,
addr2line will print a line containing the name
of the function corresponding to program address
hexaddress, followed by a line with the file
name and line number.
If the
-p option was specified,
addr2line will print line number information and
function name on one line in human readable manner. If the
-i option was also specified,
addr2line will print the caller function
information prefixed with “(inlined by)”.
The
addr2line utility prints the file name and line
number using the format “FILENAME:LINENUMBER”.
If a file or function name could not be determined,
addr2line will print a question mark in their
place. If the line number could not be determined,
addr2line will print a zero in its place.
To map address 080483c4 in the default executable
a.out to a source file name and line number use:
% addr2line 080483c4
To map address 080483c4 in executable
helloworld,
use:
% addr2line -e helloworld 080483c4
To have
addr2line act as a filter reading addresses
from its standard input use:
% addr2line
To print the function name corresponding to an address in addition to its source
file and line number use:
% addr2line -f 080483c4
The
addr2line utility exits 0 on success,
and >0 if an error occurs.
nm(1),
elfdump(1),
elfcopy(1),
strtoull(3)
The
addr2line utility was written by
Kai Wang
<
kaiwang27@users.sourceforge.net>.