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 a0xprefix 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 isa.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, ifmaininlinescallee1which inlinescallee2, and the address is fromcallee2, you'll also get the source info forcallee1andmainπ-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-iis 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@fileoption 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
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