<div dir="ltr">I've posted this as issue <a href="https://dwarfstd.org/issues/240507.1.html">240507.1</a>.<div><br></div><div>-cary</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 8, 2024 at 3:47 AM Martin via Dwarf-discuss <<a href="mailto:dwarf-discuss@lists.dwarfstd.org">dwarf-discuss@lists.dwarfstd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Small correction<br>
<br>
   property MyProp: integer read public MyFunc write MyMember;<br>
<br>
Should be<br>
   property MyProp: integer read public MyFunc write MyMember; default;<br>
<br>
As I added the  DW_AT_Default_Property flag in the example.<br>
In FreePascal, this would currently only be valid for properties with <br>
array-indexes, but may be extended in future. For the example it just <br>
shows where the attribute would go.<br>
<br>
<br>
<br>
On 08/05/2024 12:35, Martin via Dwarf-discuss wrote:<br>
> Here are 2 examples of what it would look like<br>
> <br>
> ## Property with different visibility<br>
> <br>
> ```<br>
>    type<br>
>      TFoo = class<br>
>      private<br>
>        MyMember: integer;<br>
>        function MyFunc: integer;<br>
>      protected<br>
>        // "read public" is currently from oxygene, but may be added to <br>
> FreePascal<br>
>        property MyProp: integer read public MyFunc write MyMember;<br>
>      end;<br>
> <br>
>      TBar = clall(TFoo)<br>
>      public<br>
>        property MyProp; // elevate to public<br>
>      end;<br>
> ```<br>
> <br>
> ```<br>
>    DW_TAG_Structure_type<br>
>      DW_AT_Name :  "TFoo"<br>
> L1:<br>
>      DW_TAG_Member<br>
>          DW_AT_Name            :  "MyMember"<br>
>          DW_AT_Type            :  <...><br>
>          DW_AT_Member_location :  <...><br>
> L2:<br>
>      DW_TAG_subprogram<br>
>          DW_AT_Name            :  "MyFunc"<br>
>          DW_AT_Type            :  <...><br>
> <br>
>      DW_TAG_Property<br>
>          DW_AT_Name             :  "MyProp"<br>
>          DW_AT_Type             :  <...><br>
>          DW_AT_Accessibility    :  DW_ACCESS_protected<br>
>          DW_AT_Default_Property :  TRUE<br>
>        DW_TAG_Property_Getter<br>
>            DW_AT_Property_Forward :  reference to L2<br>
>            DW_AT_Accessibility    :  DW_ACCESS_public<br>
>        DW_TAG_Property_Setter<br>
>            DW_AT_Property_Forward :  reference to L1<br>
> <br>
>    DW_TAG_Structure_type<br>
>      DW_AT_Name :  "TBar"<br>
>      DW_TAG_Inheritance<br>
>          <...><br>
>      DW_TAG_Property<br>
>          DW_AT_Name             :  "MyProp"<br>
>          DW_AT_Accessibility    :  DW_ACCESS_public<br>
> ```<br>
> <br>
> ## Property with access to nested field<br>
> <br>
> <br>
> ```<br>
>    type<br>
>      TFoo = class<br>
>        OtherData: DWORD;<br>
>        FNested: record<br>
>          MyMember: integer;<br>
>        end;<br>
>        property MyProp: integer read FNested.MyMember;<br>
>      end;<br>
> ```<br>
> <br>
> ```<br>
> L1:<br>
>    DW_TAG_Structure_type<br>
> L2:<br>
>      DW_TAG_Member<br>
>          DW_AT_Name            :  "MyMember"<br>
>          DW_AT_Type            :  <...><br>
>          DW_AT_Member_location :  <...>    ! inside FNested<br>
> <br>
>    DW_TAG_Structure_type<br>
>      DW_AT_Name :  "TFoo"<br>
>      DW_TAG_Member<br>
>          DW_AT_Name :  "OtherData"<br>
>      DW_TAG_Member<br>
>          DW_AT_Name :  "FNested"<br>
>          DW_AT_Type            :  reference to L1<br>
>          DW_AT_Member_location :<br>
>                DW_OP_plus_uconst 4             ! where 4 == offset of <br>
> MyMember in the instance data<br>
> <br>
>      DW_TAG_Property<br>
>          DW_AT_Name             :  "MyProp"<br>
>          DW_AT_Type             :  <...><br>
>        DW_TAG_Property_Getter<br>
>            DW_AT_Property_Forward :  reference to L2<br>
>            DW_AT_Property_Object  :<br>
>                DW_OP_push_object_address  ! maybe should be on stack by <br>
> default<br>
>                DW_OP_plus_uconst 4        ! where 4 == offset of <br>
> MyMember in the instance data<br>
>                                           ! There could be several <br>
> levels of nesting, so that expression could be more complex<br>
> ```<br>
> <br>
> In the example the property does not have a reference to FNested itself. <br>
> All it needs is the object_address of FNested, so it can calculate the <br>
> location of the referenced field MyMember (using the member_location).<br>
> <br>
> <br>
<br>
-- <br>
Dwarf-discuss mailing list<br>
<a href="mailto:Dwarf-discuss@lists.dwarfstd.org" target="_blank">Dwarf-discuss@lists.dwarfstd.org</a><br>
<a href="https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss" rel="noreferrer" target="_blank">https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss</a><br>
</blockquote></div>