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

Ondrej Pokorny lazarus at kluug.net
Wed Sep 30 11:54:34 CEST 2020


On 30.09.2020 11:33, Michael Van Canneyt wrote:
> On Wed, 30 Sep 2020, Ondrej Pokorny via lazarus wrote:
>> Yes, I implemented them, IIRC. Don't remember the details, though. I 
>> added TDate, TDateTime and TTime formatters. It was quite a simple 
>> addon, should be easy to find in the sources.
>
> Good news :-)
>
> How to activate them ? Because everywhere I tried, a TDateTime is still
> displayed as a float: 44104.47848875 does not look like a date/time I can
> recognize...  :-)
>
> I tried tooltip evaluation, evaluate/modifiy, inspect, local variables,
> watches. None of them seems to use this.

Strange, they are enabled by default. They get activated in 
ide\debugmanager.pas :
constructor TDebugManager.Create(TheOwner: TComponent);
//...
   RegisterValueFormatter(skSimple, 'TDate', @DBGDateTimeFormatter);
   etc.

Tooltip evaluation: works for me
Watches: works for me
Local Variables: doesn't work for me - strange, I have to re-check. I 
thought it worked here.
Inspect: OK, I forgot about this one
Evaluate/modify: forgot about this one as well - but probably we need 
the reversed function as well to be able to write the modified formatted 
value back.

>> The problem of object-based visualizers like a visualizer for 
>> TStrings is that your Lazarus IDE has to be compiled with the same 
>> FPC version/codebase that you also use for the debugged program. In 
>> Delphi this is usually the case (if you don't fiddle with RTL sources 
>> to fix bugs). In FPC/Lazarus this doesn't need to apply. I usually 
>> build Lazarus IDE less frequently than I update and build FPC trunk. 
>> Or you can build Lazarus with FPC stable but develop applications 
>> with FPC trunk. In that case such additions are unsafe.
>
> I understand this need to keep versions aligned, but for the average 
> user who simply installs Lazarus, this will always be the case: they 
> get lazarus/FPC bundled.
>
> In this matter the Laz/FPC developers are the exception.
> (one could think "it's their own fault that they make it difficult" ;-) )
>
> So with this caveat in mind, I think support for object-based visualizers
> should definitely be added. Lazarus can easily enough detect that the 
> version
> of FPC it uses for a project differs from the FPC version the IDE was 
> compiled
> with, and disable the object-based visualizers.

I probably said bullshit here. We get the detailed information about the 
object contents from the debugger, we don't use the object directly. So 
it should be possible with different FPC/RTL versions. This, of course, 
needs a much more sophisticated visualizer support in the IDE than there 
currently is. But that should be not really hard to make.

Ondrej



More information about the lazarus mailing list