solaris non gcc compiler debug options

Started by Kris Jurkaover 21 years ago4 messagesbugs
Jump to latest
#1Kris Jurka
books@ejurka.com

Compiling on solaris with a non gcc compiler does not correctly enable
debugging when --enable-debug is specified. src/template/solaris is
specifying CFLAGS="-O -v" and -O overrides the -g that --enable-debug
adds.

Kris Jurka

#2Bruce Momjian
bruce@momjian.us
In reply to: Kris Jurka (#1)
Re: [BUGS] solaris non gcc compiler debug options

Kris Jurka wrote:

Compiling on solaris with a non gcc compiler does not correctly enable
debugging when --enable-debug is specified. src/template/solaris is
specifying CFLAGS="-O -v" and -O overrides the -g that --enable-debug
adds.

Good point. Our template files should be _adding_ to CFLAGS and
CPPFLAGS, not overriding them. Later optimization flags on the
command line override earlier ones, so this patch should fix the
problem, and it exists in a few platforms. Applied.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+22-22
#3Kris Jurka
books@ejurka.com
In reply to: Bruce Momjian (#2)
Re: [BUGS] solaris non gcc compiler debug options

On Sat, 27 Nov 2004, Bruce Momjian wrote:

Kris Jurka wrote:

Compiling on solaris with a non gcc compiler does not correctly enable
debugging when --enable-debug is specified. src/template/solaris is
specifying CFLAGS="-O -v" and -O overrides the -g that --enable-debug
adds.

Good point. Our template files should be _adding_ to CFLAGS and
CPPFLAGS, not overriding them. Later optimization flags on the
command line override earlier ones, so this patch should fix the
problem, and it exists in a few platforms. Applied.

I don't believe you've fixed an actual problem. Manually set CFLAGS are
already accounted for in configure.in (line 234) here:

# CFLAGS are selected so:
# If the user specifies something in the environment, that is used.
# else: If the template file set something, that is used.
# else: If the compiler is GCC, then we use -O2.
# else: If the compiler is something else, then we use -0.

if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
elif test "${CFLAGS+set}" = set; then
: # (keep what template set)
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
# if the user selected debug mode, don't use -O
if test "$enable_debug" != yes; then
CFLAGS="-O"
fi
fi

It seems the test at the end of this (enable_debug != yes) needs to be
added to the solaris template instead of unconditionally adding -O to
CFLAGS. I was trying to debug a problem and --enable-debug wasn't really
helping until I took -O out of this src/template/solaris line. The man
page isn't particularly clear on what "best-effort" is, but it wasn't good
enough for me.

If you issue -g, and the optimization level is -x03 or
lower, the compiler provides best-effort symbolic
information with almost full optimization. Tail-call
optimization and back-end inlining are disabled.

Kris Jurka

#4Bruce Momjian
bruce@momjian.us
In reply to: Kris Jurka (#3)
Re: [BUGS] solaris non gcc compiler debug options

OK, I see now. I backed out my previous patch and did one so Solaris
has no optimization for debug. Patch attached.

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

Kris Jurka wrote:

On Sat, 27 Nov 2004, Bruce Momjian wrote:

Kris Jurka wrote:

Compiling on solaris with a non gcc compiler does not correctly enable
debugging when --enable-debug is specified. src/template/solaris is
specifying CFLAGS="-O -v" and -O overrides the -g that --enable-debug
adds.

Good point. Our template files should be _adding_ to CFLAGS and
CPPFLAGS, not overriding them. Later optimization flags on the
command line override earlier ones, so this patch should fix the
problem, and it exists in a few platforms. Applied.

I don't believe you've fixed an actual problem. Manually set CFLAGS are
already accounted for in configure.in (line 234) here:

# CFLAGS are selected so:
# If the user specifies something in the environment, that is used.
# else: If the template file set something, that is used.
# else: If the compiler is GCC, then we use -O2.
# else: If the compiler is something else, then we use -0.

if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
elif test "${CFLAGS+set}" = set; then
: # (keep what template set)
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
# if the user selected debug mode, don't use -O
if test "$enable_debug" != yes; then
CFLAGS="-O"
fi
fi

It seems the test at the end of this (enable_debug != yes) needs to be
added to the solaris template instead of unconditionally adding -O to
CFLAGS. I was trying to debug a problem and --enable-debug wasn't really
helping until I took -O out of this src/template/solaris line. The man
page isn't particularly clear on what "best-effort" is, but it wasn't good
enough for me.

If you issue -g, and the optimization level is -x03 or
lower, the compiler provides best-effort symbolic
information with almost full optimization. Tail-call
optimization and back-end inlining are disabled.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+25-25