You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by barries <ba...@slaysys.com> on 2001/05/10 22:11:51 UTC

gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

[cross-posting to new-httpd, since that's the more appropriate forum]

Background: I had trouble single-stepping through the routine defined by

   AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED)

.

On Fri, May 04, 2001 at 02:21:25PM -0700, Doug MacEachern wrote:
> 
> it looks fine to me, what is the problem exactly?

Ok, got back to playing with this today: looks like the default CFLAGS
setting for autoconf (created by AC_PROG_CC) is "-g -O2".  That seems
like an odd combination to me, but it's as-installed on two RedHats and
a FreeBSD.

When running httpd-2.0's ./configure with either of --with-debug
--enable-maintainer-mode, the pesky -O2 remains, causing my
single-stepping problems. Doing the oddball

   CFLAGS=-g ./configure --with-maintainer-mode ...

gets rid of the -O2 and single stepping seems to work nicely.

Playing with gcc a bit, it seems (not sure) that -O sets
-fomit-frame-pointer which (at the least) prevents gdb from being able
to step back into a routine defined by a macro from subroutines it
calls.

Is this a real issue, or am I or my system confused somehow? How do
others handle this?

- Barrie

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
> Should the apr/configure.in prevent -O... options when it notes a -g?
> Seems like it's an awkward "reasonable default" for debug / maintainer
> mode.

I don't think it should default to anything, but then I am not Gnu.
I've never had any problems stepping through -O2 code, but that was
before all the hooks turned into macros.

....Roy


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
> Should the apr/configure.in prevent -O... options when it notes a -g?
> Seems like it's an awkward "reasonable default" for debug / maintainer
> mode.

I don't think it should default to anything, but then I am not Gnu.
I've never had any problems stepping through -O2 code, but that was
before all the hooks turned into macros.

....Roy


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by barries <ba...@slaysys.com>.
On Thu, May 10, 2001 at 08:37:38PM -0700, Roy T. Fielding wrote:
> 
> Yes, that is the standard "reasonable default" per the Gnu project's
> makefile standards, which is why autoconf sets it.  As you discovered,
> it can be overridden by setting any value for CFLAGS prior to running
> configure.

Should the apr/configure.in prevent -O... options when it notes a -g?
Seems like it's an awkward "reasonable default" for debug / maintainer
mode.

Thanks,

Barrie

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by barries <ba...@slaysys.com>.
On Thu, May 10, 2001 at 08:37:38PM -0700, Roy T. Fielding wrote:
> 
> Yes, that is the standard "reasonable default" per the Gnu project's
> makefile standards, which is why autoconf sets it.  As you discovered,
> it can be overridden by setting any value for CFLAGS prior to running
> configure.

Should the apr/configure.in prevent -O... options when it notes a -g?
Seems like it's an awkward "reasonable default" for debug / maintainer
mode.

Thanks,

Barrie

Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
> Ok, got back to playing with this today: looks like the default CFLAGS
> setting for autoconf (created by AC_PROG_CC) is "-g -O2".  That seems
> like an odd combination to me, but it's as-installed on two RedHats and
> a FreeBSD.

Yes, that is the standard "reasonable default" per the Gnu project's
makefile standards, which is why autoconf sets it.  As you discovered,
it can be overridden by setting any value for CFLAGS prior to running
configure.

....Roy


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by "Roy T. Fielding" <fi...@ebuilt.com>.
> Ok, got back to playing with this today: looks like the default CFLAGS
> setting for autoconf (created by AC_PROG_CC) is "-g -O2".  That seems
> like an odd combination to me, but it's as-installed on two RedHats and
> a FreeBSD.

Yes, that is the standard "reasonable default" per the Gnu project's
makefile standards, which is why autoconf sets it.  As you discovered,
it can be overridden by setting any value for CFLAGS prior to running
configure.

....Roy


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 10 May 2001, barries wrote:

> [cross-posting to new-httpd, since that's the more appropriate forum]
> 
> Background: I had trouble single-stepping through the routine defined by
> 
>    AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED)

seems like the rest of your message missing?  i suspect you're having
trouble because you will not see the code normally expanded by cpp when
debugging with gdb.  the only work around i know of is to run the file
through gcc -E to get the expanded output, paste the expanded macro into
the .c file in place of the macro call and recompile.



Re: gcc -g -O2 ==> gdb stepping problems [Was: gdb & mod_perl-2.0?]

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 10 May 2001, barries wrote:

> [cross-posting to new-httpd, since that's the more appropriate forum]
> 
> Background: I had trouble single-stepping through the routine defined by
> 
>    AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED)

seems like the rest of your message missing?  i suspect you're having
trouble because you will not see the code normally expanded by cpp when
debugging with gdb.  the only work around i know of is to run the file
through gcc -E to get the expanded output, paste the expanded macro into
the .c file in place of the macro call and recompile.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org