Creating symbol table for gdb using cmake

只谈情不闲聊 提交于 2019-11-29 22:12:33

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.

Jespa

Add this line to the file CMakeLists.txt:

set(CMAKE_BUILD_TYPE Debug)

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