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.

***********************************************************************************
[r...@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

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

Reply via email to