[fpc-devel] Dwarf Standard - implementing...

Martin Frb lazarus at mfriebe.de
Fri May 17 13:49:30 CEST 2024


On 09/05/2024 19:53, Martin Frb via fpc-devel wrote:
> It's now an issue for the Dwarf standard.
> https://dwarfstd.org/issues/240507.1.html

Looking at the time other proposals have taken, I think it is reasonable 
to implement properties as custom extension now. And then later make any 
amendments (best case, just change the numeric constants for the 
DW_TAG/_AT... ).

I have done some experiments on Joost's work. But I now reached the 
point were I do need feedback and help:
https://gitlab.com/martin_frb/fpc-src/-/compare/main...martin-dwarf-prop-2?from_project_id=28644964&straight=false

Joost's code had some of the "tai" sizes hard-coded in dbgdwarf.pas. I 
moved that into each of the "tai" classes.
https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6_2741_2831
> begin
> { write dummy for now }
> AddConstToAbbrev(ord(DW_FORM_string));
> append_to_al_dwarf_info(tai_string.create(''),1);



Joost's code did write labels to the "tai" list, where the location of 
the label was unknown, and later
See "|TPendingOffsetConst" in 
|https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6

I tried to use (local) labels for that. This only happens if the Dwarf 
target DIE is in the same CU.
However, I encountered some issues
- On Linux, I think I get global labels.
- I needed labels for TSym
- for code like
     TFoo = record a: integer; property b: integer read a; end;
     TBar = type TFoo;
   TBar is written using the same symbol (same instance). So I can't get 
2 labels (currently the same label gets written twice, leading to an error)

So what is the best way to proceed there?


I also did not yet manage to create a link to the static variable that 
is written for static fields, when it is referred by a class property. 
But maybe that can be done, when static fields are moved inside the 
class....  DWARF-5 "5.7.7 Class Variable Entries" allows DW_TAG_Variable 
in a structure.


Btw, while writing the dwarf, is there a way to tell from the data, if a 
property is written because setter/getter are declared here, or because 
it changes only visibility?

Other comments/suggestions?



A lazarus proof of concept counter part.
(To view properties, each watch still must have "function calling" enabled)
https://gitlab.com/martin_frb/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20240517/38507e05/attachment.htm>


More information about the fpc-devel mailing list