is there any C++ name-mangling decoder for g++?
Asked
Active
Viewed 2.2k times
49
-
18Some guys will soon answer `c++filt` – Johannes Schaub - litb Dec 17 '10 at 08:29
-
1Voting to reopen: http://stackoverflow.com/questions/4465872/why-does-typeid-name-return-weird-characters-using-gcc-and-how-to-make-it-prin clearly requires it to be from inside the code, and only for types, which never appear on object files (as opposed to functions). This one is usually interpreted as "on object files from the command line". – Ciro Santilli OurBigBook.com Jun 05 '15 at 13:28
-
2it old but I have been helped by this site a lot https://demangler.com/ – Stefano Mtangoo Mar 06 '16 at 11:08
4 Answers
73
You can use c++filt to demangle c++ symbols. For instance
$ c++filt -n _Z1fv
f()

ryan_s
- 7,826
- 3
- 27
- 28
14
c++filt, example usage here:
6
You may also be interested on the -C
option of objdump
:
objdump -CSr main.o
which demangles relocation references like:
char *sn = new char[4];
10: bf 04 00 00 00 mov $0x4,%edi
15: e8 00 00 00 00 callq 1a <main+0x1a>
16: R_X86_64_PC32 operator new[](unsigned long)-0x4
Without -C
it would show the mangled name _Znam
.
See also: Can objdump un-mangle names of C++ template functions?
There are also some online demanglers mentioned at Is there an online name demangler for C++? like http://demangler.com/ If it exists, there is SaaS of it.
nm
also has a -C
option.

Community
- 1
- 1

Ciro Santilli OurBigBook.com
- 347,512
- 102
- 1,199
- 985
1
you have c++filt. Recently I found an online tool as well.
1.
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…]
Example: c++filt symbol
- Online solution visit

ANjaNA
- 1,404
- 2
- 16
- 29