<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 09/05/2024 19:53, Martin Frb via
      fpc-devel wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:976bc2a5-993e-46e8-9cee-162999e1fc21@mfriebe.de">It's
      now an issue for the Dwarf standard.
      <br>
      <a class="moz-txt-link-freetext" href="https://dwarfstd.org/issues/240507.1.html">https://dwarfstd.org/issues/240507.1.html</a></blockquote>
    <br>
    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... ).<br>
    <br>
    I have done some experiments on Joost's work. But I now reached the
    point were I do need feedback and help:<br>
<a class="moz-txt-link-freetext" href="https://gitlab.com/martin_frb/fpc-src/-/compare/main...martin-dwarf-prop-2?from_project_id=28644964&straight=false">https://gitlab.com/martin_frb/fpc-src/-/compare/main...martin-dwarf-prop-2?from_project_id=28644964&straight=false</a><br>
    <br>
    Joost's code had some of the "tai" sizes hard-coded in dbgdwarf.pas.
    I moved that into each of the "tai" classes.<br>
<a class="moz-txt-link-freetext" href="https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6_2741_2831">https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6_2741_2831</a><br>
    <blockquote type="cite">
      <pre class="code highlight" lang="pascal"><span>            <span
      class="k">begin</span></span>
<span>              <span class="cm">{ write dummy for now }</span></span>
<span>              <span class="n">AddConstToAbbrev</span><span
      class="p">(</span><span class="n">ord</span><span class="p">(</span><span
      class="n">DW_FORM_string</span><span class="p">));</span></span>
<span>              <span class="n"><span class="left addition">append_to_</span>al_dwarf_info</span><span
      class="p">(</span><span class="n">tai_string</span><span class="p">.</span><span
      class="n">create</span><span class="p">(</span><span class="s">''</span><span
      class="p">)<span class="addition">,</span></span><span
      class="addition"> </span><span class="m"><span
      class="right addition">1</span></span><span class="p">);</span></span>
</pre>
    </blockquote>
    <br>
    <br>
    <br>
    Joost's code did write labels to the "tai" list, where the location
    of the label was unknown, and later <br>
    See "<code><span class="n">TPendingOffsetConst</span><span class="p">"
        in </span></code><a class="moz-txt-link-freetext" href="https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6">https://gitlab.com/freepascal.org/fpc/source/-/commit/6623ccd6245bb0b8d2d46453ac680c18d6c6aad1#1666e6c01f5086b3630dcd10a1b24557a1c178f6</a><br>
    <br>
    I tried to use (local) labels for that. This only happens if the
    Dwarf target DIE is in the same CU.<br>
    However, I encountered some issues<br>
    - On Linux, I think I get global labels. <br>
    - I needed labels for TSym<br>
    - for code like<br>
        TFoo = record a: integer; property b: integer read a; end;<br>
        TBar = type TFoo;<br>
      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)<br>
    <br>
    So what is the best way to proceed there?<br>
    <br>
    <br>
    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.<br>
    <br>
    <br>
    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?<br>
    <br>
    Other comments/suggestions?<br>
    <br>
    <br>
    <br>
    A lazarus proof of concept counter part.<br>
    (To view properties, each watch still must have "function calling"
    enabled)<br>
    <a class="moz-txt-link-freetext" href="https://gitlab.com/martin_frb/lazarus">https://gitlab.com/martin_frb/lazarus</a><br>
  </body>
</html>