Thread: Debugging symbols by default

Debugging symbols by default

From
Peter Eisentraut
Date:
We had discussed a while ago that it might be a good idea to compile with
debugging symbols by default, at least when using GCC.  Personally, I
think that that would be a good idea, for users and developers alike.

If we go with that, I'd like to implement a new target 'install-strip'
that strips the binaries while they are installed, as a compensation if
you will.  (It strips the libraries in intelligent ways, too.)

This could be a win-win situation.  Developers don't need to type
--enable-debug all the time, users don't need to recompile when we ask
them to trace a bug, and if you're pressed for disk space then
'install-strip' will save you even more space than simply omitting
debugging symbols.  (Or you can keep the unstripped binaries around
elsewhere for debugging -- the possibilities are endless ;-) )

Comments?

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Debugging symbols by default

From
Larry Rosenman
Date:
On Fri, 2002-04-05 at 16:55, Peter Eisentraut wrote:
> We had discussed a while ago that it might be a good idea to compile with
> debugging symbols by default, at least when using GCC.  Personally, I
> think that that would be a good idea, for users and developers alike.
> 
> If we go with that, I'd like to implement a new target 'install-strip'
> that strips the binaries while they are installed, as a compensation if
> you will.  (It strips the libraries in intelligent ways, too.)
> 
> This could be a win-win situation.  Developers don't need to type
> --enable-debug all the time, users don't need to recompile when we ask
> them to trace a bug, and if you're pressed for disk space then
> 'install-strip' will save you even more space than simply omitting
> debugging symbols.  (Or you can keep the unstripped binaries around
> elsewhere for debugging -- the possibilities are endless ;-) )
> 
> Comments?
With the Caldera (nee SCO) compiler -O and -g are mutually exclusive. 
If you include both, you'll get -g. 

I'd recommend against this for production use with the Caldera cc and CC
compilers. 

LER
-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Re: Debugging symbols by default

From
Peter Eisentraut
Date:
Larry Rosenman writes:

> On Fri, 2002-04-05 at 16:55, Peter Eisentraut wrote:
> > We had discussed a while ago that it might be a good idea to compile with
> > debugging symbols by default, at least when using GCC.  Personally, I
^^^^^^^^^^^^^^

> With the Caldera (nee SCO) compiler -O and -g are mutually exclusive.
> If you include both, you'll get -g.
>
> I'd recommend against this for production use with the Caldera cc and CC
> compilers.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Debugging symbols by default

From
Peter Eisentraut
Date:
> We had discussed a while ago that it might be a good idea to compile with
> debugging symbols by default, at least when using GCC.

A tricky questions is what to do with the --enable-debug option.  For GCC
it would become --disable-debug (i.e., remove -g from CFLAGS), but I'm not
sure we'd need that if we provide 'make install-strip'.

For other compilers, it's anyone's guess.  We could continue to provide
--enable-debug to add -g to CFLAGS.  Some commerical vendors' compilers
actually support various combinations of debugging and optimizing these
days, but with different flags.  So if you really try to build with
debugging support on those platforms you'd probably want to supply the
CFLAGS yourself.

I suppose one of the less confusing choices would be to not have that
option.  Setting CFLAGS yourself is even less typing on average.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: Debugging symbols by default

From
Bruce Momjian
Date:
I am not sure about the idea of -g by default. I know lyx uses -g by
default, and the compile/install takes forever.  In fact, I have removed
-g from my compiles here because it takes too long to compile/link and I
do it too often.  When I need to debug, I recompile with -g.  My concern
is that we may start to look very bloated with -g and those huge
binaries.  My question is whether it is worth the install slowness/bloat?

---------------------------------------------------------------------------

Peter Eisentraut wrote:
> > We had discussed a while ago that it might be a good idea to compile with
> > debugging symbols by default, at least when using GCC.
> 
> A tricky questions is what to do with the --enable-debug option.  For GCC
> it would become --disable-debug (i.e., remove -g from CFLAGS), but I'm not
> sure we'd need that if we provide 'make install-strip'.
> 
> For other compilers, it's anyone's guess.  We could continue to provide
> --enable-debug to add -g to CFLAGS.  Some commerical vendors' compilers
> actually support various combinations of debugging and optimizing these
> days, but with different flags.  So if you really try to build with
> debugging support on those platforms you'd probably want to supply the
> CFLAGS yourself.
> 
> I suppose one of the less confusing choices would be to not have that
> option.  Setting CFLAGS yourself is even less typing on average.
> 
> -- 
> Peter Eisentraut   peter_e@gmx.net
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: Debugging symbols by default

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> I am not sure about the idea of -g by default. I know lyx uses -g by
> default, and the compile/install takes forever.  In fact, I have removed
> -g from my compiles here because it takes too long to compile/link and I
> do it too often.  When I need to debug, I recompile with -g.  My concern
> is that we may start to look very bloated with -g and those huge
> binaries.  My question is whether it is worth the install slowness/bloat?

PostgreSQL compile time is minimal compared to other packages.  If you're
worried about 30 seconds, turn off the optimization or use parallel make.
If you see yourself doing a full build too often, turn on dependency
tracking.  The extra time you spend building with -g is the time you save
yourself and the users from having to recompile everything because a bug
needs to be tracked down.  And when you rebuild, the bug might not be
reproduceable.

I don't buy the disk space argument either.  If you're worried about a few
megabytes then you going to have a lot of trouble running a database.
And if you're still worried, you can run install-strip, which is the
standard way to do it.

-- 
Peter Eisentraut   peter_e@gmx.net