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 Tim Bray <Ti...@Sun.COM> on 2008/01/10 01:56:28 UTC

Debugging httpd

Hi... I'm back to work on mod_atom and chasing a weird bug around.   
Anyhow I totally can't figure out what some apr code is doing so I  
wanted to step into it with the debugger.  This sounds lame, but I  
can't figure out how to build an httpd that has APR linked with debug  
information.

What are the approved incantations to make an httpd with some control  
over the -O and -g options?

  -Tim

Re: Debugging httpd

Posted by Tim Bray <Ti...@Sun.COM>.
On Jan 9, 2008, at 5:53 PM, William A. Rowe, Jr. wrote:

>>>> What are the approved incantations to make an httpd with some  
>>>> control over the -O and -g options?
>>>
>>> It helps if you remember apr's CFLAGS are trusted by apr-util, httpd
>>> etc, but you need to re - ./configure after rebuilding apr to  
>>> utilize
>>> this trick.
>> So... something like this?
>> > rm -rf /usr/local/apr/*
>> > cd srclib/apr
>> > "CFLAGS=-g" ./configure
>> > make
>> > make install
>> > cd ../..
>> > "CFLAGS=-g" ./configure
>
> Nope, if it's in-tree it's all one configure.  I was assuming you  
> build
> apr, apr-util and then httpd which is typical on most systems today.

Hmm... I download the source from httpd.apache.org, and it comes with  
APR in the tree.

> But just do it once with the cflags and let us know it works.

So far, I can't seem to get a debuggable apr into the build.  It may  
be the fact that ./configure is hell-bent on sticking -L/usr/lib in  
front of -L/usr/local/apr/lib in $LDFLAGS, so it's probably picking up  
the libapr that came with OS X.  I hate to get in and hack the  
Makefile itself, but am leaning that way.  -Tim

> I didn't see you do a make clean in that list (?).  Also double check
> that the evil libtool doesn't do a strip {binpath} for your platform.

At the moment, the language does not contain words sufficient to  
express the depth of my loathing for autotools.  I'll probably get  
over it.  -T


Re: Debugging httpd

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Tim Bray wrote:
> On Jan 9, 2008, at 5:16 PM, William A. Rowe, Jr. wrote:
> 
>>> Hi... I'm back to work on mod_atom and chasing a weird bug around.  
>>> Anyhow I totally can't figure out what some apr code is doing so I 
>>> wanted to step into it with the debugger.  This sounds lame, but I 
>>> can't figure out how to build an httpd that has APR linked with debug 
>>> information.
>>> What are the approved incantations to make an httpd with some control 
>>> over the -O and -g options?
>>
>> It helps if you remember apr's CFLAGS are trusted by apr-util, httpd
>> etc, but you need to re - ./configure after rebuilding apr to utilize
>> this trick.
> 
> 
> So... something like this?
> 
>  > rm -rf /usr/local/apr/*
> 
>  > cd srclib/apr
>  > "CFLAGS=-g" ./configure
>  > make
>  > make install
> 
>  > cd ../..
>  > "CFLAGS=-g" ./configure

Nope, if it's in-tree it's all one configure.  I was assuming you build
apr, apr-util and then httpd which is typical on most systems today.

But just do it once with the cflags and let us know it works.

I didn't see you do a make clean in that list (?).  Also double check
that the evil libtool doesn't do a strip {binpath} for your platform.

Re: Debugging httpd

Posted by Tim Bray <Ti...@Sun.COM>.
On Jan 9, 2008, at 5:16 PM, William A. Rowe, Jr. wrote:

>> Hi... I'm back to work on mod_atom and chasing a weird bug around.   
>> Anyhow I totally can't figure out what some apr code is doing so I  
>> wanted to step into it with the debugger.  This sounds lame, but I  
>> can't figure out how to build an httpd that has APR linked with  
>> debug information.
>> What are the approved incantations to make an httpd with some  
>> control over the -O and -g options?
>
> It helps if you remember apr's CFLAGS are trusted by apr-util, httpd
> etc, but you need to re - ./configure after rebuilding apr to utilize
> this trick.


So... something like this?

 > rm -rf /usr/local/apr/*

 > cd srclib/apr
 > "CFLAGS=-g" ./configure
 > make
 > make install

 > cd ../..
 > "CFLAGS=-g" ./configure
 > make
 > make install

I *think* I did that.  If you tell me you think something like that  
should work, I'll try again.

At the moment, the symptom is:

/usr/local/apache2/ 1092> gdb bin/httpd
GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct  2 04:07:49  
UTC 2007)
Copyright 2004 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 "i386-apple-darwin"...Reading symbols for  
shared libraries ........ done

(gdb) b main
Breakpoint 1 at 0xa021: file main.c, line 440.
(gdb) b apr_global_mutex_create
Breakpoint 2 at 0xa45e

AAAARGH.

Re: Debugging httpd

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Tim Bray wrote:
> Hi... I'm back to work on mod_atom and chasing a weird bug around.  
> Anyhow I totally can't figure out what some apr code is doing so I 
> wanted to step into it with the debugger.  This sounds lame, but I can't 
> figure out how to build an httpd that has APR linked with debug 
> information.
> 
> What are the approved incantations to make an httpd with some control 
> over the -O and -g options?

It helps if you remember apr's CFLAGS are trusted by apr-util, httpd
etc, but you need to re - ./configure after rebuilding apr to utilize
this trick.