How do I generate symbol information to use with Linux version of Intel's VTune Amplifier?

删除回忆录丶 提交于 2019-12-08 00:51:08

问题


I am using Intel VTune Amplifier XE 2011 to analyze the performance of my program. I want to be able to view the source code in the analysis results, and the documentation says I need to provide the symbol information. Unfortunately, it does not state how to generate that symbol information when compiling my program. In the Windows version of VTune all I had to do was provide the ".pdb" file that Microsoft Visual Studio would generate. Is there a similar kind of file I can create using g++ to provide this symbol information?


回答1:


gcc -g <your stuff> should be all that's necessary. However I used an older version.

The command line options for the newer stuff is here

EDIT: This SO answer is probably more valuable than anything here.




回答2:


Have you tried compiling with -g ? Normally that is all you need to generate symbolic data for debuggers, profilers, etc.

Incidentally, for profiling on Linux, Zoom from RotateRight.com is a lot more user-friendly than VTune.




回答3:


The most "classic" way to get an executable to contain the debug information with GCC is to specify the "-g" command line option as mentioned by the other posters. This does not incur any performance hit since debug information resides in ELF sections which are not part of the code or data segment. That is, the .debug* sections are not mapped into the memory during normal program execution, it's only the debug time when the debugger gets them in.

Another useful consideration for any developer working on production software is to use separate debug information files. That assumes compiling the program with "-g" as described above and then using objcopy utility to copy out the ELF sections containing debug information into a separate file and adding a link from the original binary file to the separate debug information file. This is extremely useful for being able to store the debug information for the bits you released to a customer so that post-mortem debugging is possible. And of course, for performance profiling on the release bits, too.



来源:https://stackoverflow.com/questions/4696113/how-do-i-generate-symbol-information-to-use-with-linux-version-of-intels-vtune

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