C++FILT(1)
πΈ NAME πΈ
okay so the manual name here is c++filt, and its whole job is to 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 π
bestie, listen. C++ and Java both have function overloading, which means you can make a bunch of functions with the same name as long as each one takes different parameter types π So how does the compiler tell them apart? It encodes each one into a low-level assembler name that uniquely identifies that version. This is called mangling, and it is lowkey chaotic to read. Enter c++filt [1] π¦ It does the inverse: it decodes (demangles) those low-level names back into user-level names so humans can actually read them.
Every alphanumeric word in the input (letters, digits, underscores, dollar signs, or periods) is treated as a potential mangled name β¨ If it decodes into a C++ name, that name replaces the low-level one in the output. If it doesn't, the original word just stays put. So you can feed a whole assembler source file full of mangled names through c++filt and get the same file back with everything demangled π§
You can also decode individual symbols straight from the command line:
c++filt <symbol>
If you don't give any symbol arguments, c++filt reads symbol names from standard input instead. Everything gets printed to standard output. The difference between the two is important, so pay attention π Command-line arguments are expected to be just mangled names, and no checking is done to separate them from any surrounding text. So for example:
c++filt -n _Z1fv
works and demangles to "f()" π But this one?
c++filt -n _Z1fv,
won't work. That extra comma at the end makes the mangled name invalid π
This one does work:
echo _Z1fv, | c++filt -n
and it displays "f(),", which is the demangled name followed by the trailing comma. The reason it's allowed is that names read from standard input might be part of an assembler source file, where there could be extra characters hanging off the end of a mangled name. Like:
.type _Z1fv, @function
π¦ OPTIONS π¦
-_,--strip-underscoreβ some systems slap an underscore on the front of every name. The C name"foo"ends up as"_foo"at the low level π This option strips that leading underscore off. Whetherc++filtstrips it by default depends on the target.-n,--no-strip-underscoreβ don't strip the leading underscore.-p,--no-paramsβ when demangling a function's name, skip showing the types of its parameters.-t,--typesβ tries to demangle types as well as function names. This is off by default, because mangled types are mostly used internally by the compiler and they can get mixed up with regular names. For instance, a function called"a"treated as a mangled type name would come out as"signed char"π¬-i,--no-verboseβ leave out any implementation details in the demangled output.-r,-R,--recurse-limit,--no-recurse-limit,--recursion-limit,--no-recursion-limitβ turns the recursion limit on or off while demangling. Mangling formats allow infinite nesting, so some strings could eat up 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. It's on by default, but you might need to turn it off to demangle truly complicated names. Just know that with the limit disabled, stack exhaustion is possible, and any bug reports about that will be rejected.
The -r option is a synonym for --no-recurse-limit. The -R option is a synonym for --recurse-limit.
-s format,--format=formatβc++filtcan decode the different mangling styles used by different compilers. The argument you pass here picks which one it uses:"auto"β automatic selection based on the executable (this is the default) β¨"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 thec++filtoptions and exits π«Ά--versionβ prints the version number ofc++filtand exits.@fileβ reads command-line options from file. The options inside get swapped in right where the original@fileoption was. If file doesn't exist or can't be read, the option gets treated literally and isn't removed. Options inside file are separated by whitespace. To include a whitespace character in an option, wrap the whole option in single or double quotes. Any character (backslash included) can be included by putting a backslash in front of it. The file can contain more@fileoptions too, and those get processed recursively π
π FOOTNOTES π
- MS-DOS doesn't allow
+characters in file names, so on MS-DOS this program is calledCXXFILTπ
π SEE ALSO π
the Info entries for binutils π
π₯ COPYRIGHT π₯
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, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License" β
okay that's the whole tea, bestie π binutils 2.45, last updated 2025-12-03. go demangle something iconic π§π
π¦ where this page comes from
- ubuntu questing: binutils-common 2.45-7ubuntu1.2
- ubuntu questing: binutils-x86-64-linux-gnu 2.45-7ubuntu1.2
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms