ADDR2LINE(1)

πŸ“¦ version 12.2.0, in nixpkgs unstable

πŸ’… ADDR2LINE(1) β€” your girl's guide to the GNU Development Tools manual

okay so bestie, welcome to addr2line(1), straight out of the GNU Development Tools lineup. this is the page you want when your program is being mysterious and you've got a pile of hex numbers and zero vibes. let's get into it 🫢


✨ NAME ✨

addr2line β€” it converts addresses into file names and line numbers. that's it, that's the whole job, and it does it beautifully.


🌸 SYNOPSIS 🌸

addr2line [-a|--addresses]
          [-b bfdname|--target=bfdname]
          [-C|--demangle[=style]]
          [-e filename|--exe=filename]
          [-f|--functions] [-s|--basename]
          [-i|--inlines]
          [-p|--pretty-print]
          [-j|--section=name]
          [-H|--help] [-V|--version]
          [addr addr ...]

look at her. all those flags. main character energy fr πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so addr2line translates addresses into file names and line numbers. you hand it an address in an executable, or an offset in a section of a relocatable object, and it goes digging through the debugging information to figure out which file name and line number are associated with it. literally detective work, but make it cute πŸ”

the executable or relocatable object you want to use is specified with the -e option. the default is the file a.out. the section in the relocatable object to use is specified with the -j option.

addr2line has two modes of operation, and yes she switches between them effortlessly πŸ’β€β™€οΈ

  • mode one: hexadecimal addresses are specified on the command line, and addr2line displays the file name and line number for each address.
  • mode two: addr2line reads hexadecimal addresses from standard input, and prints the file name and line number for each address on standard output. in this mode, addr2line may be used in a pipe to convert dynamically chosen addresses. piping, iconic ✨

the format of the output is FILENAME:LINENO. by default each input address generates one line of output. simple, clean, no notes.

two options can generate additional lines before each FILENAME:LINENO line (in that order):

  • if the -a option is used then a line with the input address is displayed.
  • if the -f option is used, then a line with the FUNCTIONNAME is displayed. this is the name of the function containing the address.

one option can generate additional lines after the FILENAME:LINENO line:

  • if the -i option is used and the code at the given address is present there because of inlining by the compiler then additional lines are displayed afterwards. one or two extra lines (if the -f option is used) are displayed for each inlined function.

alternatively, if the -p option is used then each input address generates a single, long, output line containing the address, the function name, the file name and the line number. if the -i option has also been used then any inlined functions will be displayed in the same manner, but on separate lines, and prefixed by the text (inlined by).

if the file name or function name can not be determined, addr2line will print two question marks in their place. if the line number can not be determined, addr2line will print 0. not her fault, she's doing her best 😭

πŸŽ€ OPTIONS πŸŽ€

the long and short forms of options, shown here as alternatives, are equivalent. no cap, they're the same thing.

  • -a, --addresses β€” display the address before the function name, file and line number information. the address is printed with a 0x prefix to easily identify 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. 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 is a.out.
  • -f, --functions β€” display function names as well as file and line number information.
  • -s, --basenames β€” display only the base of each file name.
  • -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 address is from "callee2", the source information for "callee1" and "main" will also be printed. it's giving family tree 🧚
  • -j, --section β€” read offsets relative to the specified section instead of absolute addresses.
  • -p, --pretty-print β€” make the output more human friendly: each location are printed on one line. if option -i is specified, lines for all enclosing scopes are prefixed with (inlined by).
  • *@file*β€” read command-line options from *file*. the options read are inserted in place of the original@`file option. 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. it's recursion bestie, she goes deep πŸ’€


πŸ’œ SEE ALSO πŸ’œ

info entries for binutils.


copyright (c) 1991-2018 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".


and that's the page, bestie πŸŽ€ mwah πŸ’‹

binutils-2.30 🌈 2018-01-27 🌈 that's the version and the date this little legend was born β€” go forth and demangle your addresses, you've got this πŸ‘‘βœ¨

πŸ“¦ where this page comes from