[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Single Page

Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 4.4 I tried to use (Content-Type|Location|whatever), but it appears in my Browser?
Next Document: 4.6 I'm using CGI with QUERY_STRING embedded in my HTML, but it gets corrupted?


4.5 How can I run my CGI program 'live' in a debugger?



David S. Jackson offers the following tip:

> I have a very good trick for debugging CGIs written in C/C++ running on
> UNIX. You might want to add it to the debugging section of your CGI faq.
> 
> First, in your CGI code, at it's start, add "sleep(30);". This will cause
> the CGI to do nothing for thiry seconds (you may need to adjust this
> time). Compile the CGI with debuging info ("-g" in gcc) and install the
> CGI as normal. Next, using your web browser, activate the CGI. It will of
> course just sit there doing nothing. While it is 'sleeping', find it's PID
> (ps -a | grep <cgi name>). Load your debugger and attach to that PID
> ("attach <pid>" in gdb). You will also need to tell it where to find the
> symbol definitions ("symbol-file <cgi>" in gdb). Then set a break point
> after the invocation of the sleep function and you are ready to debug. Do
> be aware that your browser will eventually timeout if it doesn't recieve
> anything.

(Anyone know similar tricks for scripting languages)?




Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 4.4 I tried to use (Content-Type|Location|whatever), but it appears in my Browser?
Next Document: 4.6 I'm using CGI with QUERY_STRING embedded in my HTML, but it gets corrupted?

Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>

Last Update October 22 2009 @ 05:36 AM

Some parts © 2009 Advameg, Inc.