I've an Apache module on Mac OS X that creates random crashes. I'm able to reproduce these crashes with certain sequence of actions, which crashes produce Crash Reporter dialog "httpd quit suddenly". It is possible to method to cause Crash Reporter launch debugger (xcode, gdb, anything) rather than just exhibiting the backtrace?
I have attempted running
httpd -X however the crash does not happen then - it takes place only when many httpd's are running at the same time, and that i found not a way to add gdb to these at the same time. And So I was wishing maybe I'm able to cause CrashReporter to add the debugger when specific process crashes - it is possible to method of doing it?
Regrettably, the kind of bug you describe includes a inclination to vanish when perturbed by examination.
Nevertheless, a choice to test is starting a GDB session from the inside your module. QA1573 comes with an example using DTrace, which may appear a little cleaner, but after a little experimentation this does not appear to operate terribly well with multiple processes. (I possibly could avoid seeing a method to get DTrace to add
gdb at that time the procedure crashes you simply obtain a
proc::postsig:signal-handle probe triggered following the process has crashed.)
You could do this something similar to this out of your module:
% echo 'c' > continue.txt % osascript -e 'tell application "Terminal" to complete script "gdb -x continue.txt attach <pid>"'
which may open another Terminal window for every
You might start
gdb from outdoors rather, having a script (DTrace or else) watching for
httpd processes, and employ the
SIGSTOP method from QA1573 inside your module's code to hang about until the script observed the brand new
After couple of several weeks, I suppose we are able to say the reply is no, you cannot. :)
To debug your condition, the crash report ought to be exploitable... but when not really, you could try make it possible for apache error log and your own logging code. Then watching logs / console whenever a crash happens should help.
This is not, to the very best of my understanding or google-fu, possible, nor wouldn't it entirely seem sensible. It's not possible to get this done from
CrashReporter regardless, as the program has aborted when it runs.
However, you'll be able to use
GDB afterwards through getting
httpd to create core dumps each time a process kicks the bucket. Apache's own documentation on debugging crashes outlines the very best practices for configuring it.
Should you haven't already, be sure to rebuild apache with
-g so you've debugging stubs, or you'll finish track of garbled symbol names.