ADDR2LINE Linux Command

What is Linux addr2line Command?


addr2line COMMAND:

The addr2line command, as the name specifies, converts program addresses into file names and line numbers. When an address is given to this command along with an executable, the command uses the debugging information in the executable to find out the file name and line number associated with the given address. When the executable or relocatable object is provided to the command, the -e option is used, but by default the file a.out is used. The section in the relocatable object to use is specified with the -j option.


addr2line [option(s)] [addr(s)]


-a --addresses Show addresses
-b --target=<bfdname> Set the binary file format
-e --exe=<executable> Set the input file name (default is a.out)
-i --inlines Unwind inlined functions
-j --section=<name> Make the output easier to read for humans
-p --pretty-print Unwind inlined functions
-s --basenames Strip directory names
-f --functions Show function names
-C --demangle[=style] Demangle function names
-h --help Display help information
-v --version Display the program's version

addr2line has two modes of operation.
  • In the first, hexadecimal addresses are specified on the command line, and addr2line displays the file name and line number for each address.
  • In the second, addr2line reads hexadecimal addresses from standard input, and prints the file name and line number for each address on standard output. In this mode, addr2line may be used in a pipe to convert dynamically chosen addresses.

Ask Questions

Ask Question