C++FILT(1)

✨ NAME ✨

okay bestie, gather round β€” this one's c++filt, and it's here to demangle C++ and Java symbols. that's the whole vibe. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

c++filt [-_|--strip-underscores]
        [-j|--java]
        [-n|--no-strip-underscores]
        [-p|--no-params]
        [-s format|--format=format]
        [--help]  [--version]  [symbol...]

πŸ’… DESCRIPTION πŸ’…

so here's the tea, bestie β˜• β€” C++ and Java both do function overloading, which is a fancy way of saying you can write a million functions with the same name as long as each one takes parameters of different types. cute, right? but there's a catch.

every C++ and Java function name gets encoded into a low-level assembly label. that process? it's called mangling. 😭 iconic but unreadable.

and c++filt does the inverse mapping: it decodes (aka demangles) those low-level names back into user-level names, so the linker can keep all your overloaded functions from clashing into each other. it's giving main character energy honestly. ✨

every alphanumeric word you see in the input β€” and by alphanumeric we mean letters, digits, underscores, dollars, or periods β€” is a potential label. if that label decodes into a C++ name, the C++ name replaces the low-level name in the output. slay. πŸ’…

you can use c++filt to decipher individual symbols like this:

c++filt <symbol>

and if you don't give it any symbol arguments at all? no problem, bestie. c++filt just reads symbol names from the standard input and writes the demangled names to the standard output. all results get printed on the standard output. periodt. 🌸


πŸŽ€ OPTIONS πŸŽ€

  • -_, --strip-underscores β€” okay so on some systems, both the C and the C++ compilers slap an underscore in front of every single name. like, the C name "foo" becomes the low-level name "_foo". rude. this option removes that initial underscore. and whether c++filt removes the underscore by default? that's target dependent, so don't @ me. πŸ™ˆ
  • -j, --java β€” prints demangled names using Java syntax. the default is to use C++ syntax. pick your fighter. πŸ’œ
  • -n, --no-strip-underscores β€” do not remove the initial underscore. that's it, that's the option.
  • -p, --no-params β€” when demangling the name of a function, don't display the types of the function's parameters. minimalist queen. πŸ‘‘
  • -s format, --format=format β€” c++filt can decode various methods of mangling, used by different compilers, and the argument to this option picks which method it uses:
    • "auto" β€” automatic selection based on executable (this is the default method)
    • "gnu" β€” the one used by the GNU C++ compiler (g++)
    • "lucid" β€” the one used by the Lucid compiler (lcc)
    • "arm" β€” the one specified by the C++ Annotated Reference Manual
    • "hp" β€” the one used by the HP compiler (aCC)
    • "edg" β€” the one used by the EDG compiler
    • "gnu-v3" β€” the one used by the GNU C++ compiler (g++) with the V3 ABI.
    • "java" β€” the one used by the GNU Java compiler (gcj)
    • "gnat" β€” the one used by the GNU Ada compiler (GNAT).
  • --help β€” prints a summary of the options to c++filt and exits. bye bestie 🫢
  • --version β€” prints the version number of c++filt and exits. ✨

πŸ“ FOOTNOTES πŸ“

  1. MS-DOS does not allow "+" characters in file names, so on MS-DOS this program is named CXXFILT. no plus signs allowed, we don't make the rules. 😭

🌈 SEE ALSO 🌈

  • the Info entries for binutils.

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''.


and that's the whole page, bestie πŸ₯Ή this was binutils-2.15.97, dated 2005-04-20, and yeah β€” the manual it lives in is literally called C++FILT(1). mwah. πŸ’–πŸ’…βœ¨