Cesar,
  I have used gdb with Apache frequently, but I don't remember ever being
able to restart Apache within gdb so trust the other guys for that advice.

Here is the official Apache debugging page:
http://httpd.apache.org/dev/debugging.html
It should walk you through the basics of using gdb as a wrapper for httpd,
instructing httpd to coredump, and some other tricks.

For what it's worth, I don't remember being able to get a successful,
readable backtrace from a coredump, but maybe I'm just using the wrong apps
or app versions?

Regards,
Dave



On 6/6/07, Tyler MacDonald <[EMAIL PROTECTED]> wrote:

César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote:
> The thing is, I don't know if it's a segfault, but I'm almost sure it
> is. When I do a restart, Apache just dies.

  If it's a segmentation fault, your apache error_log will say so.

> I don't know how to use gdb with Apache. How can I know which process
> is going to serve my next request??

  You can't. If you want to debug a problem with a request, you're better
off running "httpd -X" to test the request single-threaded.

  However, if you want to test problems with a restart, you have two
choices, depending on where the problem lies: You can attach to a child
process that you're reasonably sure is going to have the problem. Or, if
the
master process is crashing as well, attach to that one.

  Really really over-simplified "gdb with apache" instructions:

  To "attach", just do something like

  gdb /usr/sbin/httpd 1234

  replaceing "1234" with the process-id you want to attach to.. then issue
a
"continue" statement, crash your module, and when it crashes, run "bt" to
get a backtrace.

  Cheers,
    Tyler

Reply via email to