[fpc-devel] A little something I've been working on...
Martin Frb
lazarus at mfriebe.de
Fri Feb 20 18:19:10 CET 2026
On 20/02/2026 16:53, Hairy Pixels via fpc-devel wrote:
> On Feb 20, 2026 at 7:02:09 PM, Graeme Geldenhuys via fpc-devel
> <fpc-devel at lists.freepascal.org> wrote:
>> What is it? A fully working, native FPC debug format and debugger. I
>> designed a new debug format from scratch (ditching the very C-centric
>> DWARF format and its many versions) and added support into FPC `main`
>> (3.3.1) via a feature branch. That's all on the compiler side.
>
> is there anything wrong with DWARF for Pascal? I use LLDB on macOS and
> there's some things I'd like improved but I figured that just due to
> how FPC implemented it and not the format itself.
>
The biggest sore with DWARF that I was aware of was properties. But they
have been added to the DWARF standard (including indexed and more).
Well, there is also "managed types" that are absent => that is needed,
if such data should be modified by the debugger.
One could argue, that there also is the lack of many scoping rules for
Pascal....
But, partly that lack is caused by stuff not provide by FPC, which would
be possible, and in other parts it would be of very limited help.
------
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.
------
What is not foreseen in Dwarf is unit search order and visibility.
If the Debugger encounter TGlobal, in which order should it search other
units.
But, that knowledge would in a lot of cases not be worth anything, and
more so it may be contra productive.
If a unit has
var x: TGlobal;
then debug info will point to the correct TGlobal. No problem.
If you have
Sender: TObject
and a user enters the expression
TGLobal(Sender)
then that search order may not help. Sender could be of TGlobal, even if
TGlobal is NOT IN SCOPE for the current unit.
So if the debugger would now stay in search order, you would just get an
error.
Or the wrong TGlobal is in scope of the unit, and then you get the wrong
cast.
Of course, the wrong cast can happen now too, with the absent scoping.
But the scoping would not add much help.
-------------
I don't know what the new format does in terms of calling params, and
stack resolution....
But then again, currently we don't even fully use what is there with DWARF.
Would be interesting to know which shortcomings Graeme had particularly
in mind.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20260220/44aa36ee/attachment-0001.htm>
More information about the fpc-devel
mailing list