[CMake] CMake and GDB

Nils Gladitz gladitz at sci-vis.de
Wed Sep 19 10:56:51 EDT 2012


"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


-- 
Nils Gladitz, B.Sc.
DICOM, Konnektivität und Entwicklung

Scivis wissenschaftliche Bildverarbeitung GmbH
Bertha-von-Suttner-Str. 5
D-37085 Göttingen
GERMANY
Handelsregister Nr. / Trade Register No. B3100 Göttingen
Geschäftsführer / Managing Directors Dr. Gernot Ebel, Dr. Uwe Engeland

Tel: 0049 (0)551 634181-28
E-Mail: gladitz at scivis.de
Web: www.scivis.de



More information about the CMake mailing list