ADDR2LINE(1)

πŸ’– NAME πŸ’–

addr2line β€” turns addresses into file names and line numbers, bestie. that's it, that's the whole job. πŸŽ€

it's a GNU Development Tools girlie, living her best life in the binutils friend group. 🫢


✨ SYNOPSIS ✨

addr2line [-b bfdnameβŽͺ--target=bfdname]
          [-CβŽͺ--demangle[=style]]
          [-e filenameβŽͺ--exe=filename]
          [-fβŽͺ--functions] [-sβŽͺ--basename]
          [-HβŽͺ--help] [-VβŽͺ--version]
          [addr addr ...]

🌸 DESCRIPTION 🌸

okay so picture this: you have a program address and you have an executable, and you're like "which file? which line? which girl?" πŸ’… addr2line translates program addresses into file names and line numbers. Given an address and an executable, it uses the debugging information inside the executable to figure out which file name and line number are associated with a given address. it's giving detective but make it debug info. πŸ”βœ¨

the executable you wanna use gets specified with the -e option. and if you don't say anything? the default is the file a.out. no cap. 🫢

addr2line has two modes of operation, and honestly both are iconic:

  1. In the first mode, hexadecimal addresses are specified right there on the command line, and addr2line displays the file name and line number for each address. very direct, very demure. πŸŽ€
  2. In the second mode, 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. pipeline queen behavior fr fr. 🧚

the format of the output is FILENAME:LINENO. the file name and line number for each address is printed on a separate line. and if you use the -f option, then each FILENAME:LINENO line is preceded by a FUNCTIONNAME line, which is the name of the function containing the address. so you get the whole ✨context✨ bestie.

now the sad part 😭 β€” if the file name or function name can not be determined, addr2line will print two question marks in their place. and if the line number can not be determined, addr2line will print 0. it's doing its best, okay?? give her a break. πŸ’€


πŸ‘‘ OPTIONS πŸ‘‘

the long and short forms of options, shown here as alternatives, are equivalent. so pick your fave, they're the same, periodt. πŸ’…

  • -b bfdname, --target=bfdname β€” Specify that the object-code format for the object files is bfdname. you're telling her which format the object files are in, queen of specificity. πŸ”₯
  • -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. it's literally a glow-up for your symbol names, the way that _ZN3foo3barEv becomes foo::bar() is so satisfying. πŸ¦‹βœ¨
  • -e filename, --exe=filename β€” Specify the name of the executable for which addresses should be translated. the default file is a.out. so if you don't pass this, she's just gonna go looking for a.out like it's her ex. πŸ™ˆ
  • -f, --functions β€” Display function names as well as file and line number information. more info, more slay. πŸ“‹βœ¨
  • -s, --basenames β€” Display only the base of each file name. she's keeping it short and cute, no long paths, just the vibes. πŸŽ€
also lurking in the synopsis: -H / --help and -V / --version, for when you need a lil help or you wanna know what version you're running. iykyk. πŸ’–

🌈 SEE ALSO 🌈

  • Info entries for binutils. go read those, bestie, they ate. πŸ“š

Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 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.1 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''.


okay that's the whole page bestie, we ate and left no crumbs πŸ’…βœ¨ this little love letter to your terminal is from binutils-2.15.97, dated 2005-04-20. periodt. πŸŽ€πŸ’–