Debug buildtype broken

Andreas Pakulat apaku at gmx.de
Wed Sep 19 21:44:58 CEST 2007


On 19.09.07 20:15:43, Thiago Macieira wrote:
> Andreas Pakulat wrote:
> >Hi,
> >
> >in kdelibs the CXX and CFLAGS for Debug builds are set to include -g -O2
> >which breaks debug builds. This way debug builds are usable _only_ for
> >getting backtraces, but not for actual debugging because this lets gcc
> >optimize away some local variables and also makes stepping through code
> >nearly impossible (each step may jump forth and back through the current
> >function).
> >
> >The only workaround is using debugfull buildtype, which doesn't exist on
> >win32, so I suspect its impossible to do debugging with MinGW.
> >
> >I suggest to change this to -g -O0 and leave -g -O2 to RelWithDebugInfo,
> >which currently is nearly the same as Debug.
> 
> Some flags suggestions:
> Release: -O2
> RelWithDebugInfo: -g -O2
> optimised-but-debuggable: -g -O2 -fno-inline -fno-schedule-insns -fno-reorder-blocks

Thats whats used for Debug right now and it doesn't work at all. I guess
gcc just ignores the -f's and optimizes according to -O2.

> Debug: -g -O0
> Debugfull: -g3 -O0

I'll change FindKDE4Internal.cmake next Monday then with the attached
patch. (Unless somebody has objections of course).

Andreas

-- 
Keep it short for pithy sake.
-------------- next part --------------
Index: FindKDE4Internal.cmake
===================================================================
--- FindKDE4Internal.cmake	(Revision 714235)
+++ FindKDE4Internal.cmake	(Arbeitskopie)
@@ -775,12 +775,12 @@
    # Select flags.
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
    set(CMAKE_CXX_FLAGS_RELEASE        "-O2")
-   set(CMAKE_CXX_FLAGS_DEBUG          "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+   set(CMAKE_CXX_FLAGS_DEBUG          "-g -O0")
    set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline")
    set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
    set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
    set(CMAKE_C_FLAGS_RELEASE          "-O2")
-   set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+   set(CMAKE_C_FLAGS_DEBUG            "-g -O0")
    set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline")
    set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
 


More information about the Kde-buildsystem mailing list