addr2line
![]() |
![]() |
![]() |
![]() |
addr2line
Convert addresses into line number/file name pairs (GNU)
Syntax:
addr2line_variant [-b bfdname] [-C [style]] [-e executable] [-f] [-h] [-s]
[-v] [addr ...]
Runs on:
All supported hosts.
Options:
The addr2line_variant depends on the target platform, as follows:
| Target platform: | addr2line_variant: |
|---|---|
| All targets, plus native | ntomulti-addr2line |
| ARM | ntoarm-addr2line |
| PowerPC | ntoppc-addr2line |
| SH4 | ntosh-addr2line |
| x86 | ntox86-addr2line |
- -b [bfdname] or --target[=bfdname]
- Set the binary file format to bfdname.
Supported targets include: elf32-i386, coff-i386, elf32-little, elf32-big, elf32-littlearm, elf32-bigarm, elf32-powerpc, aixcoff-rs6000, elf32-powerpcle, ppcboot, elf32-shl, elf32-sh, coff-sh, coff-shl, coff-sh-small, coff-shl-small, srec, symbolsrec, tekhex, binary, and ihex.
- -C [style] or --demangle[=style]
- Decode (demangle) low-level symbol names into user-level names. Besides removing any initial underscore prepended by the system, this makes C++ function names readable. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler.
- -e executable or --exe=executable
- Set the input file name (default is a.out) to executable.
- -f or --functions
- Show function names as well as file and line number information.
- -h or --help
- Display the usage message.
- -s or --basenames
- Strip directory names.
- -v or --version
- Display the program's version information.
Description:
addr2line translates program addresses into file names and line numbers. Given an address and an executable, it uses the debugging information in the executable to figure out which file name and line number are associated with a given address.
addr2line has two modes of operation:
- Hexadecimal addresses are specified on the command line, and addr2line displays the file name and line number for each address.
- addr2line reads hexadecimal addresses from standard stdin, and prints the file name and line number for each address on stdout. In this mode, addr2line may be used in a pipe to convert dynamically chosen addresses.
The format of the output is FILENAME:LINENO. The file name and line number for each address is printed on a separate line. If the -f option is used, then each FILENAME:LINENO line is preceded by a FUNCTIONNAME line which is the name of the function containing the address.
If the file name or function name can not be determined, addr2line will print two question marks in their place. If the line number can not be determined, addr2line will print 0.
Contributing author:
GNU
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
