ADDR2LINE(1)
β¨ ADDR2LINE(1) β¨
part of the GNU Development Tools lineup, bestie π
πΈ NAME πΈ
addr2line β the glow-up that turns addresses or symbol+offset into file names and line numbers π
π¦ SYNOPSIS π¦
addr2line [-a|--addresses]
[-b bfdname|--target=bfdname]
[-C|--demangle[=style]]
[-r|--no-recurse-limit]
[-R|--recurse-limit]
[-e filename|--exe=filename]
[-f|--functions] [-s|--basename]
[-i|--inlines]
[-p|--pretty-print]
[-j|--section=name]
[-H|--help] [-V|--version]
[addr addr ...]
π DESCRIPTION π
okay so. addr2line translates addresses or symbol+offset into file names and line numbers. Like, you hand it an address or a symbol+offset inside an executable, or an offset inside a section of a relocatable object, and it digs through the debugging information to figure out which file name and line number are associated with it. it's giving detective energy πβ¨
the executable or relocatable object you wanna poke at is chosen with the -e option. the default is the file a.out. and the section of the relocatable object is chosen with the -j option.
addr2line has two modes of operation:
- Mode one: you put hexadecimal addresses or symbol+offset right there on the command line, and
addr2lineshows the file name and line number for each address. - Mode two:
addr2linereads hexadecimal addresses or symbol+offset from standard input, and prints the file name and line number for each address to standard output. in this modeaddr2linecan live in a pipe and convert dynamically chosen addresses. iconic, honestly π«Ά
the format of the output is FILENAME:LINENO. by default, each input address generates one line of output.
two options can generate extra lines before each FILENAME:LINENO line, and they come in this order:
- if the
-aoption is used, a line with the input address gets displayed. π - if the
-foption is used, a line with theFUNCTIONNAMEgets displayed. that's the name of the function containing the address.
and one option can generate extra lines after the FILENAME:LINENO line:
- if the
-ioption is used, and the code at that address is hanging out there because the compiler inlined it, then extra lines get displayed afterwards. one or two extra lines (two if-fis also on) get displayed for each inlined function.
alternatively, if the -p option is used, each input address generates a single, long, output line containing the address, the function name, the file name and the line number. and if -i has also been used, then any inlined functions get displayed the same way, but on separate lines, prefixed by the text (inlined by).
if the file name or function name cannot be determined, addr2line prints two question marks in their place. π if the line number cannot be determined, addr2line prints 0.
when symbol+offset is used, the +offset bit is optional β except when the symbol is ambiguous with a hex number. the resolved symbols can be mangled or unmangled, except unmangled symbols with + are not allowed. no cap.
π OPTIONS π
the long and short forms of options, shown here as alternatives, are equivalent. it's giving "same vibe, different outfit" β¨
-a,--addressesβ display the address before the function name, file and line number information. the address gets printed with a0xprefix so you can easily clock it. π₯-b bfdname,--target=bfdnameβ specify that the object-code format for the object files is bfdname.-C,--demangle[=style]β decode (demangle) low-level symbol names into user-level names. besides removing any initial underscore prepended by the system, this makes C++ function names readable. different compilers have different mangling styles, so the optional demangling style argument can be used to choose an appropriate demangling style for your compiler. π§-e filename,--exe=filenameβ specify the name of the executable for which addresses should be translated. the default file isa.out.-f,--functionsβ display function names as well as file and line number information.-s,--basenamesβ display only the base of each file name. short and sweet, we love her π-i,--inlinesβ if the address belongs to a function that was inlined, the source information for all enclosing scopes back to the first non-inlined function will also be printed. for example, if"main"inlines"callee1"which inlines"callee2", and the address is from"callee2", the source information for"callee1"and"main"will also be printed.-j,--sectionβ read offsets relative to the specified section instead of absolute addresses.-p,--pretty-printβ make the output more human friendly: each location is printed on one line. if option-iis specified, lines for all enclosing scopes are prefixed with(inlined by).-r,-R,--recurse-limit,--no-recurse-limit,--recursion-limit,--no-recursion-limitβ enables or disables a limit on the amount of recursion performed whilst demangling strings. since the name mangling formats allow for an infinite level of recursion, it is possible to create strings whose decoding will exhaust the amount of stack space available on the host machine, triggering a memory fault. π the limit tries to prevent this from happening by restricting recursion to2048levels of nesting.
the default is for this limit to be enabled, but disabling it may be necessary in order to demangle truly complicated names. note however that if the recursion limit is disabled then stack exhaustion is possible and any bug reports about such an event will be rejected. π«
the -r option is a synonym for the --no-recurse-limit option. the -R option is a synonym for the --recurse-limit option.
note this option is only effective if the -C or --demangle option has been enabled.
@fileβ read command-line options from file. the options read are inserted in place of the original@fileoption. if file does not exist, or cannot be read, then the option will be treated literally, and not removed.
options in file are separated by whitespace. a whitespace character may be included in an option by surrounding the entire option in either single or double quotes. any character (including a backslash) may be included by prefixing the character to be included with a backslash. the file may itself contain additional @file options; any such options will be processed recursively. π
π SEE ALSO π
- info entries for binutils.
π COPYRIGHT π
copyright (c) 1991-2026 Free Software Foundation, Inc.
permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. a copy of the license is included in the section entitled "GNU Free Documentation License".
ok bestie that's the whole page, every flag, every default, every warning, all present and accounted for. go translate some addresses, you absolute icon π
binutils-2.47 Β· 2026-09-12 Β· xoxo, ADDR2LINE(1) π¦β¨
π¦ where this page comes from
- ubuntu stonking: binutils-bpf 2.47-6ubuntu1+2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms