debugging on os x

"rob brown" <rob-m2FK/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
I have a fastcgi app written in C++, multithreaded using fastcgiapp api.  I
am on OS X, and installed apache and fastcgi via darwinports.  Usually
everything works well.

I would like to be able to use GDB from time to time (say if it is crashing,
to find out what line it crashes on).  I haven't had success with this
however, as whenever I attach the debugger, the application just hangs (i.e.
does not send an http response).

Here's what I tried.  First I modified my code a bit to make it single
threaded, since that seems less likely to confuse the debugger than if I run
it with multiple threads, as I normally do.

Then I check that it works, in terms of sending it a request from a
browser.  A-ok.

I check the process id of my app, and then start the debugger as follows:

sudo gdb /opt/local/apache2/fastcgi-bin/myfastcgiapp 6051

It tells me it attaches, and then I can confirm that all is well by doing a
backtrace:

(gdb) bt
#0  0x9005bd18 in accept ()
#1  0x00048cc4 in OS_Accept (listen_sock=0, fail_on_intr=0,
webServerAddrs=0x0) at os_unix.c:1166
#2  0x000469b0 in FCGX_Accept_r (reqDataPtr=0xbffffc4c) at fcgiapp.c:2196
#3  0x00003800 in workerThread (dataP=0xbffffcf0, threadId=0) at
MyFastcgiApp.cpp:244
#4  0x00003ca8 in main (argc=1, argv=0xbffffeb4) at MyFastcgiApp.cpp:369

Looks like what I'd expect.

But now I hit it again with the browser, and it just hangs, and eventually
Apache gives me an "internal server error" page.  I get no indication there
has been a crash either, since normally, if my app crashes the signal
handler will write something to a log file.

Also if I modify my code so that it will crash on a request, I get nothing
(I don't think it gets that far).

Any ideas?  Is there a better way to do this? (other than print statements
to the log file....been doing that for a long time and its gotten really
really old! :) )

Thanks in advance,
-rob

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.