C++FILT(1)

πŸ“¦
version 26.09 Β· 2 versions
, in nixpkgs unstable

✨ c++filt β€” the demangler bestie ✨

ok so this is a page from GNU Development Tools, and it's about c++filt, aka the program that takes those cursed low-level names and turns them back into something a human can actually read πŸ’–

🌸 NAME 🌸

c++filt β€” demangle C++ and Java symbols. that's it. that's the job. and it slays at it πŸ’…

πŸŽ€ 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 here's the whole vibe. C++ and Java have this thing called function overloading, which literally means you can write a bunch of functions with the exact same name as long as each one takes parameters of different types. iconic, honestly. but to keep them all straight, C++ and Java encode them into a low-level assembler name that uniquely identifies each different version. that process? it's called mangling 😭 (yes, that's the real word, i'm not being dramatic for once).

c++filt [1] does the inverse mapping: it decodes (demangles) low-level names into user-level names so that they can be read. it's giving translator. it's giving main character energy 🫢

every alphanumeric word (consisting of letters, digits, underscores, dollars, or periods) seen in the input is a potential mangled name. if the name decodes into a C++ name, the C++ name replaces the low-level name in the output β€” otherwise the original word is output. so you can literally pass an entire assembler source file, containing mangled names, through c++filt and see the same source file containing demangled names. no cap, whole-file glow-up ✨

you can also use c++filt to decipher individual symbols by passing them on the command line:

c++filt <symbol>

if no symbol arguments are given, c++filt reads symbol names from the standard input instead. all the results are printed on the standard output 🌈

now here's the tea β˜• the difference between reading names from the command line versus reading names from the standard input is that command-line arguments are expected to be just mangled names and no checking is performed to separate them from surrounding text. so for example:

c++filt -n _Z1fv

will work and demangle the name to "f()" β€” whereas:

c++filt -n _Z1fv,

will not work. (note the extra comma at the end of the mangled name which makes it invalid 😭 bestie the comma is the villain). this command however will work:

echo _Z1fv, | c++filt -n

and will display "f(),", i.e., the demangled name followed by a trailing comma. this behaviour is because when the names are read from the standard input it is expected that they might be part of an assembler source file where there might be extra, extraneous characters trailing after a mangled name. for example:

    .type   _Z1fv, @function

see? the comma was never the problem. context is everything πŸ’…


πŸ’… OPTIONS πŸ’…

  • -_, --strip-underscore β€” ok so on some systems, both the C and C++ compilers put an underscore in front of every name. for example, the C name "foo" gets the low-level name "_foo". this option removes the initial underscore. whether c++filt removes the underscore by default is target dependent πŸ‘€
  • -n, --no-strip-underscore β€” do not remove the initial underscore. leave that underscore exactly where it is 🫢
  • -p, --no-params β€” when demangling the name of a function, do not display the types of the function's parameters. minimalist era πŸŽ€
  • -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 be confused with non-mangled names. for example, a function called "a" treated as a mangled type name would be demangled to "signed char". yeah. that's the chaos this setting unlocks 😭
  • -i, --no-verbose β€” do not include implementation details (if any) in the demangled output. keep it cute, keep it clean ✨
  • -r, -R, --recurse-limit, --no-recurse-limit, --recursion-limit, --no-recursion-limit β€” enables or disables a limit on the amount of recursion performed whilst demangling strings. so here's the thing: since the name mangling formats allow for an infinite level of recursion it is possible to create strings whose decoding will exhaust the amount of stack space available on the host machine, triggering a memory fault πŸ’€. the limit tries to prevent this 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 in order to demangle truly complicated names. note however that if the recursion limit is disabled then stack exhaustion is possible and any bug reports about such an event will be rejected πŸ™ˆ (they are NOT playing about this one).

the -r option is a synonym for the --no-recurse-limit option. the -R option is a synonym for the --recurse-limit option. lowercase r = off, uppercase R = on. iykyk πŸ”₯

  • -s format, --format=format β€” c++filt can decode various methods of mangling, used by different compilers. the argument to this option selects 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 are inserted in place of the original @file option. if file does not exist, or cannot be read, then the option will be 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 πŸ” (yes, it can eat its own tail. iconic.)


🌟 FOOTNOTES 🌟

  1. MS-DOS does not allow "+" characters in file names, so on MS-DOS this program is named CXXFILT. yeah. that's the whole reason 😭

πŸ’œ SEE ALSO πŸ’œ

the Info entries for binutils. go read them, they're right there 🫢

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


ok that's the whole page bestie, no details skipped, no options dropped, we ate and left zero crumbs πŸ‘‘

sign-off time πŸŽ€ this was binutils-2.46.1, dated 1980-01-01 β€” yes the date is older than most of us and it's still serving. bye bestie, go demangle something πŸ’–βœ¨

πŸ“¦ where this page comes from