[fpc-pascal] Debug a getter (was Lazarus vs MSEgui)

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sun Apr 10 01:31:53 CEST 2016


On 2016-04-09 21:34, Michael Thompson wrote:
> I was hoping someone would answer this.  I currently insert the equivalent
> of
> sHack :=  MyStrings.Text;

Yes, that is a shortcoming of using the GDB debugger. Currently querying
a result of property Getter function is not possible with GDB. You have
to store the property result in a variable. Then later delete all such
references after debugging (or use your SCM to revert such code changes).

Using GDB has many other shortcomings with the Object Pascal language
too. So I often use alternative forms of debugging.

  1) I use tiOPF's tiLog unit and can output debug info to Console or
     File, or what I use most frequent, to a non-Modal GUI window. All
     logging is cached and happens in a separate thread so doesn't slow
     down the application.

  2) fpGUI contains a modified dbgintf.pp unit, compared to the one
     included with FPC. I've also written my own GUI Debug Server, also
     included with fpGUI. So I can log color values and actually see the
     color in the debug server. I can use "live view" which can show me
     for example very frequently updated valuese (eg: mouse pointer
     position) but doesn't cause the debug server content to scroll off
     screen.

  3) I believe there is a Lazarus based debug viewer similar to (2)
     above. I think I saw some info on that on the wiki once. I can't
     remember the name though.

Mostly I use tiOPF's logging though (it doesn't require your code to be
tiOPF based). I have many code templates set up in my IDE, so adding
debug lines (wrapped in debug IFDEFs) are only 3-4 key presses away.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list