如何在 linux 上看到(C 和 C++)二进制的符号?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1379533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 19:46:21  来源:igfitidea点击:

How can I see symbols of (C and C++) binary on linux?

c++cperformanceprofilingname-mangling

提问by vehomzzz

Which tools do you guys use? How do demangle c++ symbols do be able to pass it to profiler tools, such as opannotate?

大家都用什么工具?demangle c++ 符号如何能够将其传递给分析器工具,例如opannotate

Thanks

谢谢

回答by Dan Moulding

Use nmto see all symbols and c++filtto demangle.

使用nm到看到所有的符号,并c++filt以还原函数。

Example:

例子:

nm -an foo | c++filt

回答by Mike Dunlavey

The profiling tool I use already knows the symbols and source code, since it is just the debugger. I can build the app with symbols included, even with full optimization.

我使用的分析工具已经知道符号和源代码,因为它只是调试器。即使完全优化,我也可以构建包含符号的应用程序。