[Lazarus] debugging a CGI

duilio foschi octopushole at gmail.com
Wed Jan 20 15:10:46 CET 2021


I guess I will use conditional compilation.

{$IFDEF WINDOWS} // this means I am debugging the CGI on my PC
  //read from file xxx.json
{$else} // this means the CGI is in production on my linux server
  // read from stdin
{$endif}

Thank you for your help

Duilio

On Wed, Jan 20, 2021 at 1:33 PM Martin Frb via lazarus <
lazarus at lists.lazarus-ide.org> wrote:

> 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)
> --
> _______________________________________________
> lazarus mailing list
> lazarus at lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210120/283c2915/attachment.html>


More information about the lazarus mailing list