[Lazarus] Debugging in Lazarus, cannot inspect values at breakpoints...

Martin Frb lazarus at mfriebe.de
Tue Sep 29 18:22:34 CEST 2020

On 29/09/2020 17:49, Bo Berglund via lazarus wrote:
> When I reach this breakpoint and I hover the mouse over Body.Text or
> Body.Count Lazarus shows a message saying:
> Body.Text = Type TSTRINGS has no component named TEXT
> and
> Body.Count = Type TSTRINGS has no component named COUNT
> What is that?

Its a property, and calls a getter function.

The debugger can not yet call any functions. So you can't inspect that 

It goes a step further, FPC whilst compiling does not actually add debug 
info for this property either.
The dwarf standard (at least 2 or 3, need to check the higher ones) does 
not include the ability to describe properties. (and not sure, but stabs 
does probably neither, if it does fpc still does not use it)

> Is there some setting I am missing to enable inspection of these kinds
> of data?

Unfortunately not....

Joost started working on extending fpdebug to do function calls. But its 
not yet available.
(I did see it "working" for functions that 1: take no arguments 2: 
return basic types like integer only, 3: do not raise exceptions or 
errors 4: do not have user set breakpoints in the code while being 
called ....)

And there are more issues up the road.
- AFAIK: Calling a function that returns a string (GetText) needs a 
hidden var param in which the result will be returned.
- Getting a string back, will cause a mem leak, unless the debugger can 
get enough info to decrement the strings reference

So there is a lot of work ahead
- Getting function calls to work in generic
- fpc to add debug info for such properties (potentially via custom 
extensions to the dwarf standard)
- fpc to add debug info for managed types (custom extensions to the 
dwarf standard)

More information about the lazarus mailing list