[fpc-pascal] Debugging CGI web apps

Michael Van Canneyt michael at freepascal.org
Wed Mar 24 08:44:28 CET 2010



On Wed, 24 Mar 2010, Graeme Geldenhuys wrote:

> Hi,
>
> How do others debug CGI web apps written in Object Pascal? Yesterday I
> spent a significant amount of time debugging a few difficult problems. It
> took much longer than expected. Even though the CGI apps are written in
> Object Pascal I couldn't use GDB to step through the code (if one can,
> please let me know), so i had to solely rely on logfile output.

Well, I'm currently very busy with CGI, and I use dbugintf and the 
debug server app from Lazarus. Works like a charm for me.

>
> Is there a better way of debugging CGI applications?  Note I am not using
> any web-type framework. I'm using very limited features of PWU - most
> output is simply by writeln('...') statements, but our CGI apps do use
> Cookies, OOP, Database Access etc..
>
> I have Kylix 3 Enterprise at my disposal as well. Could that maybe be used
> to help debug CGI apps? Though this might be more work than I would wish
> for, because I doubt our code is Kylix compatible.
>
> Is it at all possible to step through CGI apps with GDB?

Not directly. 
You can use the embedded server created by Joost van der sluis, (see his
webdesign package) or use a fastcgi app: as soon as it is started, connect 
gdb to it, with the -p option.

Michael.



More information about the fpc-pascal mailing list