|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
CGI PROGRAMMING
DETAILS
Question: How can I run my CGI program 'live' in a debugger?
Answer: At First,in the 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 receive anything.
|
|
|
Category |
CGI Programming Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7038 users |
Added on |
8/27/2014 |
Views |
67174 |
Rate it! |
|
|
Question:
How can I run my CGI program 'live' in a debugger?
Answer:
At First,in the 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 receive anything. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All CGI Programming Interview Questions & Answers - Exam Mode /
Learning Mode
|