C++FILT(1)

πŸ’– C++FILT(1) β€” the demangling bestie πŸ’–

okay so real talk: this is the manual page for c++filt, straight out of the GNU Development Tools collection. It's giving ✨translator✨ energy and honestly? It ate. Let's get into it. πŸ¦‹


🌸 NAME 🌸

c++filt β€” demangle C++ and Java symbols πŸ’…


✨ SYNOPSIS ✨

c++filt [-_|--strip-underscore]
        [-n|--no-strip-underscore]
        [-p|--no-params]
        [-t|--types]
        [-i|--no-verbose]
        [-r|--no-recurse-limit]
        [-R|--recurse-limit]
        [-s format|--format=format]
        [--help]  [--version]  [symbol...]

πŸŽ€ DESCRIPTION πŸŽ€

okay so bestie, here's the tea. C++ and Java both do this thing called function overloading, which basically means you can write a million functions with the exact same name, as long as each one takes parameters of different types. iconic, right? But the way they keep them all straight is by encoding them into a low-level assembler name that uniquely IDs each version. That whole process? It's called mangling. 😭

And c++filt [1] does the inverse mapping: it decodes (demangles) low-level names back into user-level names so actual humans can read them. no cap. 🫢

Every alphanumeric word (made of letters, digits, underscores, dollars, or periods) that shows up in the input is a potential mangled name. If it decodes into a C++ name, the C++ name replaces the low-level name in the output. If it doesn't? The original word gets printed as-is. So basically you can yeet an entire assembler source file full of mangled names through c++filt and get the same source file back, but with demangled names. main character behavior fr fr. πŸ’…

You can also just decipher individual symbols by passing them on the command line:

c++filt <symbol>

If you don't give it any symbol arguments, c++filt reads symbol names from standard input instead. All results go to standard output. 🌈

Now here's the ✨key difference✨ between reading names from the command line vs. from stdin: command-line arguments are expected to be just mangled names, and there's no checking done to separate them from surrounding text. So for example:

c++filt -n _Z1fv

works and demangles the name to "f()". But:

c++filt -n _Z1fv,

does not work. (Note the extra comma at the end of the mangled name β€” that's what makes it invalid. πŸ’€) This command, however, will work:

echo _Z1fv, | c++filt -n

and it'll display "f()," β€” that's the demangled name followed by a trailing comma. Why tho? Because when names are read from standard input, it's expected they might be part of an assembler source file where there could be extra, extraneous characters trailing after a mangled name. Like this, bestie:

.type   _Z1fv, @function

πŸ’… OPTIONS πŸ’…

  • -_, --strip-underscore β€” On some systems, both the C and C++ compilers slap an underscore in front of every name. For example, the C name "foo" gets the low-level name "_foo". This option removes that initial underscore. Whether c++filt removes it by default is target dependent. πŸ™ˆ
  • -n, --no-strip-underscore β€” Do not remove the initial underscore. periodt.
  • -p, --no-params β€” When demangling the name of a function, don't display the types of the function's parameters.
  • -t, --types β€” Attempt to demangle types as well as function names. This is disabled by default since mangled types are normally only used internally in the compiler, and they can get confused with non-mangled names. For example, a function called "a" treated as a mangled type name would be demangled to "signed char". 😳
  • -i, --no-verbose β€” Don't include implementation details (if any) in the demangled output.
  • -r, -R, --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” Enables or disables a limit on how much recursion happens while demangling strings. Since name mangling formats allow for an infinite level of recursion, it's possible to create strings whose decoding will exhaust the stack space available on the host machine, triggering a memory fault. The limit tries to stop that from happening by restricting recursion to 2048 levels of nesting.

The default is for this limit to be enabled, but disabling it may be necessary to demangle truly complicated names. But ngl, note this: if the recursion limit is disabled, stack exhaustion is possible and any bug reports about such an event will be rejected. πŸ’€

The -r option is a synonym for the --no-recurse-limit option. The -R option is a synonym for the --recurse-limit option.
  • -s format, --format=format β€” c++filt can decode various methods of mangling used by different compilers. The argument to this option picks which method it uses:
    • "auto" β€” Automatic selection based on executable (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 β€” Print a summary of the options to c++filt and exit. 🫢
  • --version β€” Print the version number of c++filt and exit. ⭐
  • @file β€” Read command-line options from file. The options read get inserted in place of the original @file option. If file doesn't exist, or can't be read, then the option is 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. πŸŒ€


🧚 FOOTNOTES 🧚

  1. MS-DOS does not allow "+" characters in file names, so on MS-DOS this program is named CXXFILT. πŸ“

πŸ”₯ SEE ALSO πŸ”₯

the Info entries for binutils.


Copyright (c) 1991-2025 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 whole page, bestie!! πŸ’– this manual came to you courtesy of binutils-2.44, dated 2025-03-28 β€” stay demangled, stay iconic, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from