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

Re: Patch - Debug builds without optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Greg Smith <greg(at)2ndQuadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch - Debug builds without optimization
Date: 2011-11-30 06:05:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Bruce Momjian <bruce(at)momjian(dot)us> writes:
> I have applied the attached patch to mention the debugger.  OK?

>         Server developers should consider using the configure options 
>         <option>--enable-cassert</> and <option>--enable-debug</> to enhance the
>         ability to detect and debug server errors.  They should also consider
> !       running configure with <literal>CFLAGS="-O0 -g"</> if using a debugger.

I still think this is basically useless.  If we're going to mention the
topic at all, we should provide enough information to be helpful, which
this does not.  Furthermore, it's concretely wrong in that it suggests
you need to say -g when --enable-debug already does that, and that it
fails to note that all this advice is gcc-specific.

I suggest wording along these lines:

	When developing code inside the server, it's recommended to
	use the configure options --enable-cassert, which turns on many
	run-time error checks, and --enable-debug, which improves the
	usefulness of debugging tools.

	If you use gcc, it's best to build with an optimization level
	of at least -O1, because using level -O0 disables some important
	compiler warnings (such as use of an uninitialized variable).
	However, nonzero optimization levels can complicate debugging
	because stepping through the compiled code will usually not
	match up one-to-one with source code lines.  If you get confused
	while trying to debug optimized code, recompile the specific
	file(s) of interest with -O0.  An easy way to do this with the
	Unix makefiles is "make PROFILE=-O0 file.o".

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: YAMAMOTO TakashiDate: 2011-11-30 06:37:29
Subject: Re: synchronous commit vs. hint bits
Previous:From: Tom LaneDate: 2011-11-30 05:48:05
Subject: Re: Reserved words and delimited identifiers

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