[lazarus] Debug server available.

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Thu Jan 2 10:02:52 EST 2003


Hi,

Some of you will maybe be familiar with the 'gexperts' package for Delphi.
It contains a 'debug server', with a unit 'dbugintf' to communicate with it.

The idea is that, to debug your programs, you include the 'dbugintf' unit
in the unit you wish to debug, and statements like
{$ifdef debug}
  senddebug('Passed here') ;
{$endif}
can be put in various locations. (more methods exist, to send variable values etc)

The debug server catches the messages sent by the dbugintf unit, and
displays them in a nice way.

This is very useful for debugging GUI code: A normal debugger will interfere
with the GUI events (focus shifts etc) and so messes up any attempts to
debug code. Also daemons (servlets) etc. can use this unit to do debugging.

I made such a debugserver for the kylix book I co-authored, and now I've
implemented and extended it for use with Free Pascal.

There are 2 versions:
- Console or system log.
- GTK version (currently uses fpgtk)
  Displays all messages nicely in a list, as the original 'gdebug' program.
  (there are various options which can be set)

Currently, it works on Linux, and it can use a unix domain socket,
or a TCP/IP socket. (so you can log to a debugserver on a separate host)

It seems to work nicely. I did a speed test (10000 messages in a tight loop)
And all works ok. I've committed the lot under utils/debugsvr.

Question to the Lazarus team:
Currently, there are 2 server front-ends available:
- console (also can use linux system log)
- GTK (uses a thin GTK OOP wrapper: fpgtk)
The server mechanism is available in a separate unit, so it is easy to write
a new server which handles the messages differently.

I think it would be a nice idea if someone would look at the GTK interface
(it is really small) and produce a Lazarus interface.  The GUI code is written
in such a way that you will have almost no changes to do.

I think it would even be possible to include the debug server in the lazarus
IDE itself, if properly coded.

A win32 version is in the works, I still need to port the ssockets code to
windows. AFter that it should work with just a recompile.

Comments, suggestions etc. always welcome.

Michael.






More information about the Lazarus mailing list