Debug symbols not generated using cmake

I compiled the c ++ code library github.com/RainerKuemmerle/g2o with cmake after adding

set(CMAKE_BUILD_TYPE Debug) 

to be able to debug the application. He then created an assembly file named "g2o". But when I try to debug using gdb, this is the result that 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 debugging information when using cmake?

+6
source share
1 answer

Your approach with adding set(CMAKE_BUILD_TYPE Debug) works fine.

But g2o is a program that was built with Release options. Debug g2o version of g2o is called g2o_d . Thus, for debugging you need to run the debugger as follows:

 user2@arm _machine:~/g2o/trunk/bin$ gdb g2o_d 

Note
Different names are not a common feature of CMake , but only a 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") 
+2
source

Source: https://habr.com/ru/post/972525/


All Articles