如何在 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
How can I see symbols of (C and C++) binary on linux?
提问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 nm
to see all symbols and c++filt
to 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.
我使用的分析工具已经知道符号和源代码,因为它只是调试器。即使完全优化,我也可以构建包含符号的应用程序。