[CMake] CMake and GDB

GOO Creations goocreations at gmail.com
Wed Sep 19 11:07:23 EDT 2012


Stupid, stupid me. Yes it works, I just ran GDB with "start" instead of 
"run".
Thanks for your help Nils.

Chris


On 2012/09/19 04:56 PM, Nils Gladitz wrote:
> "cmake -DCMAKE_BUILD_TYPE=Debug" should be enough to get gdb 
> debuggable binaries.
> Is the process which you intend to debug running when you ask gdb for 
> a backtrace?
> You will only be able to get a backtrace if the process has been 
> started and has not yet exited.
>
> e.g.:
> gdb ./mybin
> break main
> run
> backtrace
>
> Nils
>
> On 09/19/2012 04:43 PM, GOO Creations wrote:
>> Hi,
>>
>> I'm trying to debug my program using GDB. I've done the following:
>>
>> -DCMAKE_BUILD_TYPE=Debug
>> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g")
>> SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
>>
>> But whenever I run GDB and do a backtrace, I get a message: "No Stack".
>> I've done a Google search and apparently the -g flag is never passed 
>> to g++.
>> Is -g automatically added when my build type is "Debug"? Does anyone 
>> know why GDB gives me this error?
>>
>> Thanks
>> Chris
>> -- 
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: 
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
>



More information about the CMake mailing list