Hello,I'm sending following patch which disables optimization when --enable-debug is passed. It was nasty (for me, at least) that debug build required passing of CFLAGS with -O0 to get nice traceable code.
Regards, Radek
diff --git a/configure.in b/configure.in old mode 100644 new mode 100755 index e6232af..3759645 --- a/configure.in +++ b/configure.in @@ -194,10 +194,10 @@ PGAC_ARG_BOOL(enable, spinlocks, yes, [do not use spinlocks]) # -# --enable-debug adds -g to compiler flags +# --enable-debug adds -g and (-O0) to compiler flags # PGAC_ARG_BOOL(enable, debug, no, - [build with debugging symbols (-g)]) + [build with debugging symbols (-g) and no optimization (-O0)]) AC_SUBST(enable_debug) # @@ -402,7 +402,7 @@ unset CFLAGS # If the user specifies something in the environment, that is used. # else: If the template file set something, that is used. # else: If coverage was enabled, don't set anything. -# else: If the compiler is GCC, then we use -O2. +# else: If the compiler is GCC, then we use -O2, unless debug is passed. # else: If the compiler is something else, then we use -O, unless debugging. if test "$ac_env_CFLAGS_set" = set; then @@ -412,11 +412,18 @@ elif test "${CFLAGS+set}" = set; then elif test "$enable_coverage" = yes; then : # no optimization by default elif test "$GCC" = yes; then - CFLAGS="-O2" + # if the user selected debug mode, use -O0, instead of nothing equivalent to + # (-O1) + if test "$enable_debug" != yes; then + CFLAGS="-O0" + else + CFLAGS="-O2" + fi else - # if the user selected debug mode, don't use -O + # if the user selected debug mode, use -O0, instead of nothing equivalent to + # (-O1) if test "$enable_debug" != yes; then - CFLAGS="-O" + CFLAGS="-O0" fi fi
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers