addr2line - Linux


addr2line is a command-line utility that converts a hexadecimal address to a source code file and line number. This is commonly used to translate the output of stack traces to readable code locations, aiding in debugging and error analysis.


addr2line [options] <address> [<executable-file>]


  • -C: Demangle C++ symbols.
  • -e: Print the executable file’s name, regardless if it’s the same as the current process.
  • -f: Print the full path to the source code file.
  • -i: Print the function name only, without the source code path or line number.
  • -s: Print the source code line, without the path or function name.


Example 1: Convert a single address

addr2line 0x100082b /path/to/my_program

Example 2: Convert multiple addresses with path printing

addr2line -f 0x100082b 0x1000980 /path/to/my_program

Example 3: Print only the function name

addr2line -i 0x100082b /path/to/my_program

Common Issues

  • Address not found: The given address may not exist in the specified executable file. Ensure you’re using the correct executable and that the address is valid.
  • Ambiguous address: In some cases, multiple source code locations may match the given address. addr2line will report the first matching location.
  • No source code available: If the executable file was built without debugging information, addr2line may not be able to determine the source code location.


addr2line is often used in conjunction with other debugging tools such as gdb and valgrind. You can pipe the output of these tools into addr2line to translate the stack traces.

Related Commands

  • objdump: Dump the object code of an executable file, including its symbol table.
  • readelf: Display the ELF header and section information of an executable file.