C++FILT(1)
π c++filt β the demangler bestie you didn't know you needed
okay so this is from the GNU Development Tools manual, page c++filt(1), and honestly? it's giving "unsung hero of debugging" and I'm obsessed. let's get into it π«Ά
β¨ NAME β¨
c++filt β it demangles C++ and Java symbols. that's the whole vibe. lowkey magic tbh πͺ
πΈ 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...]
like yes, it's a lot of flags, but bestie, we're gonna walk through every single one π
π¦ DESCRIPTION π¦
so here's the tea β β C++ and Java both do this thing called function overloading, which means you can write a million functions all named the same thing as long as each one takes parameters of different types. iconic behavior honestly.
but to keep track of which "same-named" function is which, C++ and Java encode them into a low-level assembler name that uniquely identifies each different version. that process is called mangling π (yes that's the real word).
and c++filt<footnote>[1]</footnote>? it does the inverse β it decodes (demangles) those low-level names back into user-level names so you can actually read them. main character energy fr fr π
so how does it decide what's a mangled name? every alphanumeric word (letters, digits, underscores, dollars, or periods) you see in the input is a potential mangled name. if the name decodes into a C++ name β boom, the C++ name replaces the low-level name in the output. if not β the original word just gets output as-is. so you can literally pipe an entire assembler source file full of mangled names through c++filt and get the same source file back, but demangled. slay β¨
you can also use c++filt to 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 the results go to standard output. π
and here's the important diff, ngl: command-line args 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 β that's what makes it invalid, bestie π)
this command, however, will work:
echo _Z1fv, | c++filt -n
and it'll display "f()," β i.e. the demangled name followed by a trailing comma. why? because when names are read from standard input, the tool expects they might be part of an assembler source file, where there might be extra, extraneous characters trailing after a mangled name. like:
.type _Z1fv, @function
see? it all makes sense now π
π OPTIONS π
-_,--strip-underscoreβ 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. whetherc++filtremoves the underscore by default is target dependent π-n,--no-strip-underscoreβ do not remove the initial underscore. simple as that β-p,--no-paramsβ when demangling the name of a function, don't display the types of the function's parameters. keep it mysterious π-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". so like... know what you're asking for, bestie.-i,--no-verboseβ do not include implementation details (if any) in the demangled output. no extra commentary, just vibes β¨-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. here's the why: since the name mangling formats allow for an infinite level of recursion, it's 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 that 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 π (yes, seriously, they said that).
the -r option is a synonym for the --no-recurse-limit option. the -R option is a synonym for the --recurse-limit option. 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 toc++filtand exit π«Ά--versionβ print the version number ofc++filtand exit π@file β read command-line options from file. the options read are inserted in place of the original@file option. if file doesn't exist, or can't be read, then the option will be treated literally, and not removed β so it'll just sit there looking like a weird arg, no cap.
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, recursion inside your recursion. it's giving inception.)
π§ FOOTNOTES π§
- MS-DOS does not allow
"+"characters in file names, so on MS-DOS this program is namedCXXFILT. historical lore, bestie ππ
π₯ SEE ALSO π₯
the Info entries for binutils. go read them, they're right there π«Ά
π 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, 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 βbinutils-2.45.1, dated2026-01-23, from theC++FILT(1)manual. go forth and demangle. periodt. π β¨
π¦ where this page comes from
- arch rolling: or1k-elf-binutils 2.45.1-1 Β· GPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms