C++ name mangling decoder for g++?
Asked Answered
D

4

50

is there any C++ name-mangling decoder for g++?

Drudge answered 17/12, 2010 at 8:26 Comment(3)
Some guys will soon answer c++filtAnodic
Voting to reopen: #4466372 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".Houppelande
it old but I have been helped by this site a lot demangler.comPredigestion
H
73

You can use c++filt to demangle c++ symbols. For instance

$ c++filt -n _Z1fv
f()
Hamrnand answered 17/12, 2010 at 8:31 Comment(0)
S
14

c++filt, example usage here:

Can we see the template instantiated code by C++ compiler

Speechmaking answered 17/12, 2010 at 8:30 Comment(0)
H
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.

Houppelande answered 5/6, 2015 at 12:11 Comment(1)
or even objdump -CSr main.o | less --pattern=_ZnamKoser
F
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

for more info

  1. Online solution visit
Fidelafidelas answered 14/4, 2022 at 5:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.