← 返回命令列表

Linux command

addr2line 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

addr2line -e [path/to/executable] [address]

Example

addr2line -e [path/to/executable] -f [address]

Demangle

addr2line -e [path/to/executable] -f -C [address]

Pretty-print

addr2line -e [path/to/executable] -f -C -i -p [address]

Read addresses from stdin

cat [addresses.txt] | addr2line -e [path/to/executable] -f -C

说明

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.

参数

-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
-j, --section _NAME_
Treat input addresses as offsets within the named section.
--target _BFDNAME_
Specify the binary format of the object file (auto-detected by default).
-r, --no-recurse-limit
Disable the demangler's recursion limit.

FAQ

What is the addr2line command used for?

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.

How do I run a basic addr2line example?

Run `addr2line -e [path/to/executable] [address]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -e, --exe executable do in addr2line?

Specify the executable to examine