[GNC-dev] debug info

c.holtermann at gmx.de c.holtermann at gmx.de
Sat Dec 15 09:16:00 EST 2018


Hello,

when debugging for my recent pull request #439 I needed to use
gdb. When compiling the maint branch from github I didn't have debug
information (line numbers) in gdb. I needed to add them by including
the -g flag in CMakelLists.txt. I did it only for c and not for c++.
Patch below for illustrative purposes.

Wouldn't it be good to have a command line option or environment
variable to enable that debug information for c and c++ ?

regards,

Christoph Holtermann

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 860954143..5527cd99e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -567,7 +567,7 @@ set(CMAKE_CXX_FLAGS "-std=gnu++11 
${CMAKE_CXX_FLAGS}")  # FIXME: should be -std=


  if (UNIX)
-  set( CMAKE_C_FLAGS "-Werror -Wdeclaration-after-statement 
-Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations 
-Wno-unused ${CMAKE_C_FLAGS}")
+  set( CMAKE_C_FLAGS "-g -Werror -Wdeclaration-after-statement 
-Wno-pointer-sign -Wall -Wmissing-prototypes -Wmissing-declarations 
-Wno-unused ${CMAKE_C_FLAGS}")
    set( CMAKE_C_FLAGS "-Wno-deprecated-declarations -std=gnu11 
-Wno-error=parentheses ${CMAKE_C_FLAGS}")
    set( CMAKE_CXX_FLAGS "-Werror -Wall -Wmissing-declarations 
-Wno-unused -Wno-error=parentheses ${CMAKE_CXX_FLAGS}")
    set( CMAKE_CXX_FLAGS "-Wno-deprecated-declarations 
${REGISTER_CXXFLAG} ${CMAKE_CXX_FLAGS}")


More information about the gnucash-devel mailing list