[fpc-devel] A little something I've been working on...
Martin Frb
lazarus at mfriebe.de
Sat Feb 21 17:34:39 CET 2026
On 21/02/2026 17:11, Graeme Geldenhuys via fpc-devel wrote:
> On 2026-02-20 17:19, Martin Frb via fpc-devel wrote:
>>
>> E.g. currently
>>
>> procedure foo;
>> var SeenByBar: byte;
>> procedure Bar;
>> begin {} end;
>> var NOT_SeenByBar: byte;
>> begin {} end;
>>
>> FPC currently does not include the info that the 2nd var is not in
>> scope for Bar. There would afaik be several ways. So not a Dwarf
>> problem.
>
>
> That was an interesting case - thanks for mentioning it. FPC has the
> information needed, I just had to emit it into the debug info. It took
> me about 5 minutes to include the declaration index in the debug
> output and then read that info back in the debugger engine.
Well, how long to fix it for dwarf too?
Dwarf has all we need: location expressions.
Bar gets a "local var" (the declaration can be used to ident it us
being outside), and a location expression that points to the addr in the
parent stack frame.
Then all the existing debuggers could read it correctly.
The problem is not Dwarf, it is that fpc doesn't fully use it.
More information about the fpc-devel
mailing list