ADDR2LINE(1)

✨ ADDR2LINE(1) β€” GNU Development Tools πŸ’–

okay bestie, let's talk about addr2line πŸ¦‹ it's the GNU Development Tools manual page, and it's literally the cutest way to turn raw addresses into file names and line numbers. no cap, you're gonna be obsessed 🫢

πŸŽ€ NAME

addr2line β€” convert 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 πŸ’œ ngl it's giving detective energy. you hand it an address or symbol+offset from an executable, or an offset inside a section of a relocatable object, and it digs through the debugging info to figure out which file name and line number that address belongs to ✨

the executable or relocatable object you want is picked with the -e option. the default is the file a.out πŸ“ the section in the relocatable object is picked with the -j option.

addr2line has two modes of operation, bestie πŸ‘‘

in the first mode, you pass hexadecimal addresses or symbol+offset right on the command line, and addr2line shows the file name and line number for each one πŸ¦‹

in the second mode, addr2line reads hexadecimal addresses or symbol+offset from standard input and prints the file name and line number for each address to standard output 🌈 this mode is perfect for a pipe when you're converting addresses that get chosen on the fly πŸ’–

the output format is FILENAME:LINENO, and by default each input address gets one line of output πŸŽ€

two options can add extra lines before each FILENAME:LINENO line (in that order) 🌸

if -a is used, a line with the input address shows up πŸ’…

if -f is used, a line with the FUNCTIONNAME shows up too. that's the name of the function containing the address ✨

one option can add extra lines after the FILENAME:LINENO line πŸ”₯

if -i is used and the code at the given address is only there because the compiler inlined something, extra lines get printed afterwards. you get one or two extra lines (two if -f is also used) for each inlined function 🧚

or, if -p is used, each input address gets a single long output line with the address, the function name, the file name and the line number all together πŸ’œ if -i is also used, inlined functions show up the same way but on separate lines, prefixed by the text (inlined by) 🫢

if the file name or function name can't be figured out, addr2line prints two question marks in their place πŸ’€ if the line number can't be figured out, it prints 0 πŸ™ˆ

when symbol+offset is used, the +offset part is optional, except when the symbol could be mistaken for a hex number. symbols can be mangled or unmangled, but unmangled symbols with + are not allowed 😭

🌈 OPTIONS

the long and short forms of options are basically twins, shown here as alternatives, and they do the exact same thing πŸ‘―β€β™€οΈ

  • -a, --addresses β€” shows the address before the function name, file and line number info πŸ¦‹ the address gets a 0x prefix so it's super easy to spot πŸ’–
  • -b bfdname, --target=bfdname β€” tells it that the object-code format of the object files is bfdname πŸŽ€
  • -C, --demangle[=style] β€” decodes low-level symbol names into user-level names πŸͺ„ besides stripping the initial underscore the system tacks on, this makes C++ function names readable ✨ different compilers mangle names differently, so the optional style argument lets you pick the demangling style that matches your compiler πŸ’…
  • -e filename, --exe=filename β€” names the executable whose addresses should be translated 🌸 the default file is a.out πŸ“
  • -f, --functions β€” shows function names along with file and line number info 🧚
  • -s, --basenames β€” shows only the base of each file name 🌊
  • -i, --inlines β€” if the address belongs to an inlined function, the source info for every enclosing scope, all the way back to the first non-inlined function, gets printed too πŸ”₯ for example, if main inlines callee1 which inlines callee2, and the address is from callee2, you'll also get the source info for callee1 and main πŸ‘‘
  • -j, --section β€” reads offsets relative to the specified section instead of absolute addresses πŸ¦‹
  • -p, --pretty-print β€” makes the output more human friendly by printing each location on one line πŸ’œ if -i is specified too, lines for all enclosing scopes get prefixed with (inlined by) 🫢
  • -r, -R, --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” turns a limit on demangling recursion on or off 🌈 mangling formats allow infinite recursion, so some strings could eat all the stack space on the host machine and cause a memory fault πŸ’€ the limit stops that by capping recursion at 2048 levels of nesting ✨

the limit is on by default, but you might need to turn it off to demangle truly complicated names πŸ™ˆ heads up though: if you disable it, stack exhaustion is possible, and any bug reports about that will be rejected 😭

-r is a synonym for --no-recurse-limit, and -R is a synonym for --recurse-limit 🫢

this option only works if -C or --demangle is enabled πŸŽ€

  • @file β€” reads command-line options from file 🧚 the options read get inserted right where the original @file option was 🌸 if file doesn't exist or can't be read, the option is treated literally and doesn't get removed πŸ’€

options inside file are separated by whitespace πŸ’… a whitespace character can be part of an option if you wrap the entire option in single or double quotes πŸ“ any character (including a backslash) can be included by putting a backslash in front of it πŸ¦‹ the file can even contain more @file options, and those get processed recursively πŸ”₯

πŸ‘‘ SEE ALSO

Info entries for binutils. πŸ’œ

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" πŸŽ€


bye bestie, that's binutils-2.47 from 2026-08-11 for you πŸ¦‹ go be a main character in your debugger πŸ’–βœ¨

πŸ“¦ where this page comes from
  • arch rolling: binutils 2.47-4 Β· GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3 AND FSFAP
  • πŸ’– girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms