From aa1bbaed45300f5d459c3b697fc691b52152cbfb Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Sat, 18 Jul 2020 14:08:27 +0300 Subject: Debugging docs. --- man/magi.3 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'man') diff --git a/man/magi.3 b/man/magi.3 index 32b0c92..0ac4b78 100644 --- a/man/magi.3 +++ b/man/magi.3 @@ -157,6 +157,47 @@ code is in field of .B magi_request structure. For other modules error codes seem to be overkill. +.SH DEBUGGING +To debug your CGI scripts with +.I gdb +you can include signal.h: +.P +.RS +.nf +#include +.fi +.RE +.P +and stop your script in the beginning with: +.P +.RS +.nf +raise(SIGSTOP); +.fi +.RE +.P +Then compile your script and place it in directory which is handled by your +CGI server. +Check timeout settings for CGI scripts on your server and make it big enough, +since the server will kill your script by timeout. +Now make request to your server and run the following in the shell: +.P +.RS +.nf +gdb name_of_your_executable `pgrep name_of_your_executable` +.fi +.RE +.P +This will connect +.I gdb +to your running CGI script. It will be paused by SIGSTOP, so you will be able +to setup your breakpoints. In order to continue run: +.P +.RS +.nf +continue +.fi +.RE .SH COMPATIBILTY Sine .B magi -- cgit v1.2.3