<div dir="ltr">I guess I will use conditional compilation.<br><br>{$IFDEF WINDOWS} // this means I am debugging the CGI on my PC<br> //read from file xxx.json<br>{$else} // this means the CGI is in production on my linux server<br> // read from stdin<br>{$endif}<br><br>Thank you for your help<div><br>Duilio</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 20, 2021 at 1:33 PM Martin Frb via lazarus <<a href="mailto:lazarus@lists.lazarus-ide.org">lazarus@lists.lazarus-ide.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 19/01/2021 19:03, duilio foschi via lazarus wrote:<br>
> I would like to debug a CGI by tracing it in Lazarus IDE as a console <br>
> application in windows.<br>
><br>
> Is there a way to have the CGI read from standard input at start time?<br>
><br>
<br>
I have not tried this, but you may try to debug it using gdbserver.<br>
<br>
Tools > Options > debugger: choose gdbserver and if required change <br>
ip/port <a href="http://127.0.0.1:1234" rel="noreferrer" target="_blank">127.0.0.1:1234</a><br>
<br>
Now you can start your app on the console (I am not sure what <br>
commandline gdbserver takes / please double check)<br>
DUMMY INSTRUCTION<br>
gdbserver -host ip:port yourapp<br>
<br>
gdbserver will hold your app right at the start.<br>
Your app should be able to read and write to the console from which you <br>
started it.<br>
You can then start debugging in the IDE.<br>
<br>
<br>
Going one step further, if you are real lucky, you can put the above <br>
gdbserver line into a script, and actually run it as cgi in a webserver <br>
(if the webserver does not timeout/kill it)<br>
-- <br>
_______________________________________________<br>
lazarus mailing list<br>
<a href="mailto:lazarus@lists.lazarus-ide.org" target="_blank">lazarus@lists.lazarus-ide.org</a><br>
<a href="https://lists.lazarus-ide.org/listinfo/lazarus" rel="noreferrer" target="_blank">https://lists.lazarus-ide.org/listinfo/lazarus</a><br>
</blockquote></div>