Results 1 to 10 of 14
hi all,
i have a html page that calls a c cgi script on my local server;
how can i view the html page and debug the script at the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-03-2011 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
debug c cgi script
hi all,
i have a html page that calls a c cgi script on my local server;
how can i view the html page and debug the script at the same time?
if i would give some input in a form on the html page then i want to debug the script with the entered data.
my gues was with w3m and gdb but i don't know how its done...
thanks in advance
- 03-04-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,148
When the web server starts the CGI program, it normally would do a fork/exec. You could replace the C program with a script that has the same calling format, which in turn would start the C program in the debugger. There is a graphical debugger for Linux called Insight, from some folks at Red Hat and Cygnus. Here is a link to it: Insight home page
Alternatively, you can alter your C program so it does a longish wait after entering main(). At the point it is started, you can attach to it running gdb or whatever, and run it from there setting break points, inspecting variables, etc. You do have to build the program with debugging enabled and don't strip it before running.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-04-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,148
BTW, I just downloaded, built, and was able to run Insight. It builds its own version of GDB which may be out of date for my new SL6 (RHEL 6) system and I didn't try to do much other than see if it could be built and run, which it does, though I did have to make one minor fix to the gdb/eval.c file to keep a warning from escalating to an error (use of uninitialized variables - I just needed to memset() two arrays).
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-04-2011 #4Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
thanks for your reply, it seems very complicated but i'll give it a try!
perhaps you could give me a link to a tutorial or something?
- 03-04-2011 #5Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
no, I can and will figure it out!!
- 03-04-2011 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,148
it's not that complicated. I'm sure you'll figure it out. Just beat on it until it surrenders!
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-05-2011 #7Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
how can i set my environment variable QUERY_STRING from terminal?
(something like 'setenv QUERY_STRING var1=x&var2=y'??.
then i can debug my script that way.
- 03-05-2011 #8Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,148
What shell are you using? The standard Linux shell is bash. If that's what you are using, try this:
Code:export QUERY_STRING="var1=x&var2=y"
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-05-2011 #9Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
thanks rubberman!
- 03-07-2011 #10Just Joined!
- Join Date
- Mar 2011
- Posts
- 14
i must admit; transferring to a linux env for programming is giving me a hard time...even with simple things!
i also started with python and C cgi programming, coming from C# stand alone app development in Visual Studio you can imagine it isn't easy
thank god that its just a hobby!!
how can i avoid using the "%" sign in the css tag when you want to embed html in pyhtonLast edited by rudie; 03-07-2011 at 01:16 PM.


Reply With Quote
