View Compiler Mangled Names in C++

穿精又带淫゛_ 提交于 2019-11-30 20:00:55

You could look in the map file. Assuming you have map file generation turned on.

You can see the decorated function names by using Dependency Walker.

Open any DLL\EXE in dependency walker and in right pane you can see a list of decorated function names.

Since you also ask about other compilers. There is a tool called nm on the gnu toolchain. You will get it on linux and cygwin, and I believe that it is also available in mingw. Calling it with no parameters will show the mangled symbols in the binary. Calling it with --demangle will do the obvious.

You can view decorated (mangled) names with Dumpbin.

Ofek Shilon

While all the above works, there is a nicely documented way to view the mangled names by use of Listing Files: Project Property Pages -> C/C++ -> Output Files -> Assembler Output.

(EDIT:)

There is a reason only Listing files and DUMPBIN are documented as ways to see decorated names. Both the map file and dependency walker, suggested as solutions, display only decorated names. If you have multiple overloads of a function name, you'll have a hard time matching them to the various decorated names you'd see. (That's more or less reconstructing the decoration scheme. While possible, it defeats the whole original purpose.)

user2761565

linux gnu tool chain nm command can be used to see mangled name.

#include<iostream> 
using namespace std;

int fun1(){}
int fun1(int){}
int main()
{
return 0;
}
#g++ name_decoration_2.cpp
#nm a.out
...
...
000000000040064e T _Z4fun1i
0000000000400648 T _Z4fun1v
U _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4
U _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!