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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. timeshift: command not found
  2. How To Generate An CentOS/RHEL 6 UEFI Bootable ISO Image
  3. tune2fs: command not found
  4. UNIX / Linux : What Is a Shell? What are different Shells?
  5. efibootmgr Command Examples in Linux
  6. How to set children-max for udev Service in CentOS/RHEL 7
  7. whois Command Examples in Linux
  8. s2i: command not found
  9. How To Find When The Spfile Was Created On Linux Server
  10. How to Run a Script When USB Devices Is Attached or Removed Using UDEV

You May Also Like

Primary Sidebar

Recent Posts

  • “az storage account” Command Examples (Manage storage accounts in Azure)
  • “az sshkey” Command Examples (Manage ssh public keys with virtual machines)
  • “az redis” Command Examples
  • “az provider” Command Examples (Manage resource providers)

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright