Reputation: 547
I compiled the c++ code library at github.com/RainerKuemmerle/g2o using cmake after adding
set(CMAKE_BUILD_TYPE Debug)
so as to be able to debug the application. Then it created a build file named "g2o". But when I try debugging with gdb, this is the output I get.
user2@arm_machine:~/g2o/trunk/bin$ gdb g2o
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /scratch/mbaxkms7/ARM_Programs_mbaxkms7/g2o/trunk/bin/g2o...(no debugging symbols found)...done.
(gdb)
Is there any other way to generate debug information while using cmake?
Upvotes: 11
Views: 7560
Reputation: 5958
Your approach with adding set(CMAKE_BUILD_TYPE Debug)
works fine.
But g2o
is the program which was build with Release
options. Debug
version of g2o
is called g2o_d
. Thus to debug you need launch debugger in the following way:
user2@arm_machine:~/g2o/trunk/bin$ gdb g2o_d
Note
Different names isn't common feature of CMake
but only of the g2o
project:
# postfix, based on type
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "postfix applied to debug build of libraries")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "postfix applied to release build of libraries")
Upvotes: 5