Creating symbol table for gdb using cmake

孤街浪徒 提交于 2019-11-28 17:26:00

问题


Is there any way to create only symbol table using cmake for gdb ?


回答1:


The usual way to produce debugging information for gdb is to pass -g to the gcc or g++ compiler (and also at linking time).

Look into the Cmake FAQ for how to get a debuggable executable.




回答2:


Add this line to the file CMakeLists.txt:

set(CMAKE_BUILD_TYPE Debug)



回答3:


compile in Release mode optimized but adding debug symbols, useful for profiling :

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ...

or compile with NO optimization and adding debug symbols :

cmake -DCMAKE_BUILD_TYPE=Debug ...


来源:https://stackoverflow.com/questions/7990844/creating-symbol-table-for-gdb-using-cmake

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