C++ name mangling decoder for g++? [duplicate]

情到浓时终转凉″ 提交于 2019-11-27 11:30:54

问题


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


回答1:


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

$ c++filt -n _Z1fv
f()



回答2:


c++filt, example usage here:

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




回答3:


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.



来源:https://stackoverflow.com/questions/4468770/c-name-mangling-decoder-for-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!