Skip site navigation (1) Skip section navigation (2)

Re: --enable-debug does not work with gcc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: "Gavin Sherry" <swm(at)alcove(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: --enable-debug does not work with gcc
Date: 2007-02-02 15:23:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
NikhilS <nikkhils(at)gmail(dot)com> writes:
> True, this is how I myself circumvent this problem too. But IMHO,
> explicitly passing CFLAGS when we are invoking --enable-debug (which does
> add -g, but leaves some optimization flag around which deters debugging)
> does not seem correct?

If we did what you suggest, then --enable-debug would cause performance
degradation, which would cause people to not use it, which would result
in most binaries being completely undebuggable rather than only partially.
Doesn't sound like a good tradeoff to me.

Personally, in my development tree I use a Makefile.custom containing

# back off optimization unless profiling
ifeq ($(PROFILE),)
   CFLAGS:= $(patsubst -O2,-O1,$(CFLAGS))

-O1 still generates "uninitialized variable" warnings but the code is a
lot saner to step through ... not perfect, but saner.  It's been a
workable compromise for a long time.  I don't recommend developing with
-O0, exactly because it disables some mighty valuable warnings.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Neil ConwayDate: 2007-02-02 15:54:44
Subject: Re: Enums patch v2
Previous:From: Tom LaneDate: 2007-02-02 14:52:08
Subject: Re: Function proposal to find the type of a datum

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group