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@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@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to