You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Juhani Connolly <Ju...@ninja.co.jp> on 2009/04/13 13:46:23 UTC

Debuggin appears optimised but shouldn't be?

I'm currently trying to iron out some bugs in a module I'm working and have 
spent a day trying to get a debug environment working properly for apache.

My ./configure for apache itself was the following:
OPTIM=-O0\ 
 ./configure --prefix=/usr/local/apache-dbg/ --enable-maintainer-mode --with-apr=/usr/local/ 
 --with-apr-util=/usr/local/ --with-mpm=worker --enable-dbd --enable-so --enable-cgi

The apr/apr-util were also compiled with OPTIM=-O0 and maintainer-mode as 
well as some stuff like AP-DBD mysql.

My problem is that whan I run apache through the debugger it still seems 
blatantly like I'm running optimised code as code jumps back and forth and 
certain variable are not visible at all.

I would appreciate if someone could advise me as to what the problem is and 
how to resolve it.


************************************

Some information that may be relevant:

My module compiles in the following way when using apxs:

>make
/usr/local//build-1/libtool --silent --mode=compile 
gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread 
  -g  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG   -I/n/trunk/include/  
-I/usr/local/apache-dbg//include -I. -I/usr/local//include/apr-1 -prefer-pic 
 -c mod_ninja_ads.c && touch mod_ninja_ads.slo
/usr/local//build-1/libtool --silent --mode=link 
gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread 
  -g        -o mod_ninja_ads.la -rpath 
/usr/local/apache-dbg//modules -module -avoid-version  mod_ninja_ads.lo

A sample of gdb output:
The fact that it keeps telling me my source files are newer than my 
executable is certainly a cause of concern and I have no idea why this is 
the case as checking the library it has a last modified moments before I run 
it.

***********************************************************************************
[root@stockx bin]# gdb ./httpd
GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host 
libthread_db library "/lib64/libthread_db.so.1".

(gdb) break ninja_ads_create_svr_conf
Function "ninja_ads_create_svr_conf" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (ninja_ads_create_svr_conf) pending.
(gdb) r -X
Starting program: /usr/local/apache-dbg/bin/httpd -X
[Thread debugging using libthread_db enabled]
[New Thread 47407880549472 (LWP 23895)]
Breakpoint 2 at 0x2b1e02016b80: file mod_ninja_ads.c, line 58.
Pending breakpoint "ninja_ads_create_svr_conf" resolved
[Switching to Thread 47407880549472 (LWP 23895)]

Breakpoint 2, ninja_ads_create_svr_conf (p=0xa92d138, s=0xa945c20) at 
mod_ninja_ads.c:58
warning: Source file is more recent than executable.
58      {
(gdb) n
59              ninja_ads_srv_conf * svr = apr_pcalloc(p, 
sizeof(ninja_ads_srv_conf));
(gdb)
61      //      memset(svr->axadFiles, 0, sizeof(svr->axadFiles));
(gdb)
59              ninja_ads_srv_conf * svr = apr_pcalloc(p, 
sizeof(ninja_ads_srv_conf));
(gdb) p svr
No symbol "svr" in current context.
(gdb) n
61      //      memset(svr->axadFiles, 0, sizeof(svr->axadFiles));
(gdb)
60              svr->axadFileList = NULL;
(gdb) p svr

************************************************************************* 


Re: Debuggin appears optimised but shouldn't be?

Posted by Juhani Connolly <Ju...@ninja.co.jp>.
----- Original Message ----- 
>From: "Sorin Manolache" <so...@gmail.com>
>To: <mo...@httpd.apache.org>
>Sent: Tuesday, April 14, 2009 6:40 AM
>Subject: Re: Debuggin appears optimised but shouldn't be?
>

>On Mon, Apr 13, 2009 at 13:46, Juhani Connolly <Ju...@ninja.co.jp> wrote:
>> I'm currently trying to iron out some bugs in a module I'm working and 
>> have
>> spent a day trying to get a debug environment working properly for 
>> apache.
>>
>> My ./configure for apache itself was the following:
>> OPTIM=-O0\ ./configure --prefix=/usr/local/apache-dbg/
>> --enable-maintainer-mode --with-apr=/usr/local/ --with-apr-util=/usr/local/
>> --with-mpm=worker --enable-dbd --enable-so --enable-cgi
>
>Your configuration seems ok.
>
>Mine is
>CFLAGS="-ggdb3 -O0 -fno-inline" ./configure and the rest...
>
>and it works.
>
>Sorin
>

Thanks for confirming my config. After clearing shop entirely and 
reinstalling everything
it appears to have worked. It may be the problem was trying to build two 
different apaches(debug
and performance testing) on the same server off the same apr/apr-util. If I 
wanted to do this I presume
building separate apr/apr-utils for each installation of apache would be the 
way to go?

>-- 
>A: Because it reverses the logical flow of conversation.
>Q: Why is top-posting frowned upon?
>A: Top-posting.
>Q: What is the most annoying thing in e-mail?



Re: Debuggin appears optimised but shouldn't be?

Posted by Sorin Manolache <so...@gmail.com>.
On Mon, Apr 13, 2009 at 13:46, Juhani Connolly <Ju...@ninja.co.jp> wrote:
> I'm currently trying to iron out some bugs in a module I'm working and have
> spent a day trying to get a debug environment working properly for apache.
>
> My ./configure for apache itself was the following:
> OPTIM=-O0\ ./configure --prefix=/usr/local/apache-dbg/
> --enable-maintainer-mode --with-apr=/usr/local/ --with-apr-util=/usr/local/
> --with-mpm=worker --enable-dbd --enable-so --enable-cgi

Your configuration seems ok.

Mine is
CFLAGS="-ggdb3 -O0 -fno-inline" ./configure and the rest...

and it works.

Sorin

>
> The apr/apr-util were also compiled with OPTIM=-O0 and maintainer-mode as
> well as some stuff like AP-DBD mysql.
>
> My problem is that whan I run apache through the debugger it still seems
> blatantly like I'm running optimised code as code jumps back and forth and
> certain variable are not visible at all.
>
> I would appreciate if someone could advise me as to what the problem is and
> how to resolve it.
>
>
> ************************************
>
> Some information that may be relevant:
>
> My module compiles in the following way when using apxs:
>
>> make
>
> /usr/local//build-1/libtool --silent --mode=compile gcc -Wall
> -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread  -g
>  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG   -I/n/trunk/include/
>  -I/usr/local/apache-dbg//include -I. -I/usr/local//include/apr-1
> -prefer-pic -c mod_ninja_ads.c && touch mod_ninja_ads.slo
> /usr/local//build-1/libtool --silent --mode=link gcc -Wall
> -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread  -g
>        -o mod_ninja_ads.la -rpath /usr/local/apache-dbg//modules -module
> -avoid-version  mod_ninja_ads.lo
>
> A sample of gdb output:
> The fact that it keeps telling me my source files are newer than my
> executable is certainly a cause of concern and I have no idea why this is
> the case as checking the library it has a last modified moments before I run
> it.
>
> ***********************************************************************************
> [root@stockx bin]# gdb ./httpd
> GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu"...Using host
> libthread_db library "/lib64/libthread_db.so.1".
>
> (gdb) break ninja_ads_create_svr_conf
> Function "ninja_ads_create_svr_conf" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (ninja_ads_create_svr_conf) pending.
> (gdb) r -X
> Starting program: /usr/local/apache-dbg/bin/httpd -X
> [Thread debugging using libthread_db enabled]
> [New Thread 47407880549472 (LWP 23895)]
> Breakpoint 2 at 0x2b1e02016b80: file mod_ninja_ads.c, line 58.
> Pending breakpoint "ninja_ads_create_svr_conf" resolved
> [Switching to Thread 47407880549472 (LWP 23895)]
>
> Breakpoint 2, ninja_ads_create_svr_conf (p=0xa92d138, s=0xa945c20) at
> mod_ninja_ads.c:58
> warning: Source file is more recent than executable.
> 58      {
> (gdb) n
> 59              ninja_ads_srv_conf * svr = apr_pcalloc(p,
> sizeof(ninja_ads_srv_conf));
> (gdb)
> 61      //      memset(svr->axadFiles, 0, sizeof(svr->axadFiles));
> (gdb)
> 59              ninja_ads_srv_conf * svr = apr_pcalloc(p,
> sizeof(ninja_ads_srv_conf));
> (gdb) p svr
> No symbol "svr" in current context.
> (gdb) n
> 61      //      memset(svr->axadFiles, 0, sizeof(svr->axadFiles));
> (gdb)
> 60              svr->axadFileList = NULL;
> (gdb) p svr
>
> *************************************************************************
>



-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?