Re: Patch - Debug builds without optimization - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Patch - Debug builds without optimization
Date
Msg-id 1308239462-sup-1118@alvh.no-ip.org
Whole thread Raw
In response to Patch - Debug builds without optimization  (Radosław Smogura <rsmogura@softperience.eu>)
Responses Re: Patch - Debug builds without optimization
List pgsql-hackers
Excerpts from Radosław Smogura's message of jue jun 16 08:30:27 -0400 2011:
>  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.

I disagree with this change.  Debug builds are very useful to have in
production, and you don't want to be running -O0 there.  I have found
that you can use a src/Makefile.custom like this for those times when you
want to debug stuff in a particular set of files:

CFLAGS := $(patsubst -O2,-O0,$(CFLAGS))

Then you remove the .o files that you want to debug, and rerun make.
This places the burden on the developer wanting to mess with random code
changes.  Of course, this means that production builds are not as
debuggable, but IME it's much less of a problem there.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: On-the-fly index tuple deletion vs. hot_standby
Next
From: Alvaro Herrera
Date:
Subject: Re: Latch implementation that wakes on postmaster death on both win32 and Unix