[Lazarus] debugging a CGI

Martin Frb lazarus at mfriebe.de
Wed Jan 20 13:33:13 CET 2021


On 19/01/2021 19:03, duilio foschi via lazarus wrote:
> I would like to debug a CGI by tracing it in Lazarus IDE as a console 
> application in windows.
>
> Is there a way to have the CGI read from standard input at start time?
>

I have not tried this, but you may try to debug it using gdbserver.

Tools > Options > debugger: choose gdbserver  and if required change 
ip/port 127.0.0.1:1234

Now you can start your app on the console  (I am not sure what 
commandline gdbserver takes / please double check)
DUMMY INSTRUCTION
gdbserver -host ip:port  yourapp

gdbserver will hold your app right at the start.
Your app should be able to read and write to the console from which you 
started it.
You can then start debugging in the IDE.


Going one step further, if you are real lucky, you can put the above 
gdbserver line into a script, and actually run it as cgi in a webserver 
(if the webserver does not timeout/kill it)


More information about the lazarus mailing list