Recent

Author Topic: Debugging watch list query  (Read 2336 times)

J-G

  • Hero Member
  • *****
  • Posts: 953
Debugging watch list query
« on: March 30, 2017, 12:15:25 pm »
Why cant I show values such as Filesize(file alias)  and TEdit.Text  ??

Both of these display <Error: <Error>> rather than the value.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Debugging watch list query
« Reply #1 on: March 30, 2017, 01:54:29 pm »
gdb is not able to unravel class properties, such as TEdit.Text.
However, if the property is not accessed via a getter, but is simply a front for a (probably private) class field, gdb can show the property value if you list the variable as, for instance, FCount rather than the property named Count.

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Debugging watch list query
« Reply #2 on: March 30, 2017, 03:53:04 pm »
Thanks Howard,

I've found a 'work-around' by simply assigning the value to a local variable and 'watching' that. It just seemed inelegant/awkward.

I'll look at the 'F' option  -  is that likely to be FText? and FFilesize?  neither seem logical.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Debugging watch list query
« Reply #3 on: March 30, 2017, 10:19:17 pm »
You're out of luck with TEdit.Text, since it is set and accessed via a private setter (SetText) and a private getter (GetText).

For classes you write yourself you are more likely to have access to the field behind the property (if there is one).

You could always add a dummy field for debugging purposes and remove it later, or copy the property value to a local variable and watch that, as you have discovered.

There are other options as well. For instance the LCL makes heavy use of the Lazlogger unit, and appropriately placed DebugLn() calls.

 

TinyPortal © 2005-2018