[Lazarus] Displaying property values while debugging

Martin lazarus at mfriebe.de
Mon Jan 24 20:23:11 CET 2011


On 24/01/2011 17:54, Bo Berglund wrote:
> On Sun, 23 Jan 2011 23:46:55 +0000, Martin<lazarus at mfriebe.de>  wrote:
>> On 23/01/2011 20:29, Bo Berglund wrote:
>>> While debugging my test database application I tried to do as I
>>> ussually do in Delphi to see property values, namely to hover the
>>> mouse over a keyword when the execution has stopped in a breakpoint.
>> http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Properties
>>
>> properties that have a getter, need to call a function to get the value.
>> The debugger currently can't do this.
> Too bad, but since is a limitation I won't look further.
> Thanks!

Often you can work around those problems.

You look at the property and it's getter, and see where it get's it's 
data. then you create a watch to display it.

Unless it really does need processing. That is, if reading the property, 
does actually need to call the mysql server, then you can not get the 
data. But then if you actually would make that kind of call, you may 
change the mysql server state, or the app state, and change the outcome 
of the entire remaining code of your app. (Once property getters can be 
called... And then it's a risk, your app may or may not be affected by 
the extra call)

Also the other thing, if the getter point to a variable "property foo: 
integer read FFoo;", then make sure you compile it with dwarf (-gw)
Also make sure the LCL is compile with dwarf.
And the package containing the database code, should also be compiled 
using dwarf.

dwarf: actually -gw and -godwarfsets (the 2nd you have to specify by 
hand, in the extra options field)

----
I am using that debugging the entire IDE itself. And not once have I yet 
failed to get the data I wanted to see (well maybe once, but really 
rarely). True, it could be more convenient and all.

----------
Actually, just reviewing your original post:
> -------
> query.SQL.Text := 'EXEC SelectDongleData @@SerialNo=2485';
> = A syntax error in expression, near 'query.SQL.Text := 'EXEC
> SelectDongleData @@SerialNo=2485';

it should only sent "query.SQL.Text" to the debugger (which may or may 
not work, see the rwest of the post) => but the whole other ":= '...'" 
psacal statement shouldn't go to the debugger.
It is not by any change selected as block?

Does it work as watch (just "query.SQL.Text" ) ?

Martin





More information about the Lazarus mailing list