• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

addr2line Command Examples in Linux

by admin

addr2line is a command-line utility in Linux that is used to convert addresses in an executable or shared object file into line numbers and file names. It is commonly used in combination with tools like gdb (the GNU debugger) and objdump to translate addresses of functions or variables in a program’s binary into their corresponding source code locations.

Here is an example of how addr2line might be used:

$ $ addr2line -e myprogram 0x4005e6
/path/to/myprogram.c:23

In this example, addr2line is used to translate the address 0x4005e6 in the executable file myprogram into a file name and line number. The output indicates that the address corresponds to line 23 in the file /path/to/myprogram.c.

addr2line can be used to translate addresses from both code and data sections of an executable or shared object file. It can also be used to translate addresses from core dumps or other types of memory dumps.

addr2line Command Examples

1. Display the filename and line number of the source code from an instruction address of an executable:

# addr2line --exe={{path/to/executable}} {{address}}

2. Display the function name, filename and line number:

# addr2line --exe={{path/to/executable}} --functions {{address}}

3. Demangle the function name for C++ code:

# addr2line --exe={{path/to/executable}} --functions --demangle {{address}}

Filed Under: Linux

Some more articles you might also be interested in …

  1. ss Command Examples in Linux
  2. sbatch: command not found
  3. How to uninstall local-apt-repository software package in Ubuntu
  4. pkginfo Command Examples in Linux
  5. clamdscan: A command-line virus scanner using the ClamAV Daemon
  6. CentOS / RHEL : How to add a null route in Linux
  7. hcitool Command Examples in Linux
  8. dep: A CLI tool for deployment of PHP applications
  9. powerstat: command not found
  10. glab Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright