LinuxCommandLibrary

addr2line

Translate addresses to source file locations

TLDR

Display the filename and line number from an instruction address

$ addr2line -e [path/to/executable] [address]
copy
Display the function name, filename, and line number
$ addr2line -e [path/to/executable] -f [address]
copy
Demangle the function name for C++ code
$ addr2line -e [path/to/executable] -f -C [address]
copy

SYNOPSIS

addr2line [-e executable] [-f] [-C] [-s] [-i] [address...]

DESCRIPTION

addr2line translates addresses into file names and line numbers. Given an address in an executable or relocatable object, it uses the debugging information to figure out which file name and line number are associated with it.
This is particularly useful for interpreting crash dumps and debugging information from stack traces.

PARAMETERS

-e, --exe executable

Specify the executable to examine
-f, --functions
Display function names as well as file and line number information
-C, --demangle
Decode (demangle) low-level symbol names into user-level names (useful for C++)
-s, --basenames
Display only the base of each file name rather than the full path
-i, --inlines
If the address belongs to an inlined function, also print the caller information
-p, --pretty-print
Print output in a human-readable format
-a, --addresses
Display the address before the function name, file, and line

CAVEATS

Requires the executable to be compiled with debugging information (e.g., -g flag for gcc). Stripped executables will not provide useful output.

HISTORY

Part of GNU Binutils, a collection of binary tools for working with object files and executables.

SEE ALSO

objdump(1), nm(1), readelf(1)

> TERMINAL_GEAR

Curated for the Linux community

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99