<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Also readelf does print flag_present in .debug_info, but doesn't
      print implicit_const. (Support for DWARFv5 was merged into GNU
      binutils master few days ago).<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 02/27/2017 09:29 PM, Victor Leschuk
      via llvm-commits wrote:<br>
    </div>
    <blockquote
      cite="mid:3fe04cb1-92fb-d638-e1e1-884461b88f92@accesssoftek.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p>I think flag_present and implicit_const attributes shouldn't be
        treated as similar here: flag_present attributes physically do
        have a record in .debug_info section, while implicit_const
        attributes are not physically mentioned there.  Printing
        implicit_const values when dumping .debug_info can be more
        convenient for reader but it will actually violate the
        definition of dump. When dumping section contents we expect to
        see what is actually there, don't we?<br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 02/27/2017 09:04 PM, David Blaikie
        wrote:<br>
      </div>
      <blockquote
cite="mid:CAENS6Evjji0hdLPQhZiMD6+T9LJm_y4oCBi=Stc_5ESbvaJSZg@mail.gmail.com"
        type="cite">
        <div dir="ltr"><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr">On Mon, Feb 27, 2017 at 10:00 AM Victor
              Leschuk <<a moz-do-not-send="true"
                href="mailto:vleschuk@accesssoftek.com">vleschuk@accesssoftek.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                <p class="gmail_msg"><br class="gmail_msg">
                </p>
                <br class="gmail_msg">
                <div class="m_-7636712434836838175moz-cite-prefix
                  gmail_msg">On 02/27/2017 08:04 PM, David Blaikie
                  wrote:<br class="gmail_msg">
                </div>
                <blockquote type="cite" class="gmail_msg">
                  <div dir="ltr" class="gmail_msg">Skipping these values
                    doesn't seem to be correct - in the case of
                    flag_present, I think the value is still rendered in
                    the dump, is it not?</div>
                </blockquote>
              </div>
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                Do you mean that the value is somehow mentioned in
                .debug_info section? It is not.</div>
            </blockquote>
            <div><br>
              Looks to me like it is:<br>
              <br>
              dumping debug info for this code: void f1() { }<br>
              <br>
              produces this:<br>
              <br>
              <font face="monospace">  .debug_abbrev contents:<br>
                  ...<br>
              </font>
              <div><font face="monospace">  [2] DW_TAG_subprogram  
                  DW_CHILDREN_no</font></div>
              <div><font face="monospace">          ...</font></div>
              <div><font face="monospace">          DW_AT_external
                   DW_FORM_flag_present<br>
                  <br>
                    .debug_info contents:<br>
                    ...<br>
                    0x0000002a:   DW_TAG_subprogram [2]<br>
                                    ...<br>
                                    DW_AT_external
                  [DW_FORM_flag_present] (true)</font></div>
              <br>
            </div>
            <div>I would expect similar behavior for const_value - that
              the attribute and its constant value is printed in the
              debug_info dump.<br>
              <br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg"><br
                  class="gmail_msg">
                <blockquote type="cite" class="gmail_msg">
                  <div dir="ltr" class="gmail_msg"> I would expect the
                    same for implicit_const values. (also, this needs
                    test coverage either way)</div>
                </blockquote>
              </div>
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                Yes, you are correct. I will create tests when we decide
                what's right behavior here. <br class="gmail_msg">
                <br class="gmail_msg">
                I think skipping is correct here: we are dumping
                .debug_info data based on attributes stored in
                AbbrevDecl, this code was based on assumption that every
                attribute has representation in .debug_info section,
                that was before implicit_const form was introduced.</div>
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg"><br
                  class="gmail_msg">
                <blockquote type="cite" class="gmail_msg"><br
                    class="gmail_msg">
                  <div class="gmail_quote gmail_msg">
                    <div dir="ltr" class="gmail_msg">On Sat, Feb 25,
                      2017 at 5:27 AM Victor Leschuk via llvm-commits
                      <<a moz-do-not-send="true"
                        href="mailto:llvm-commits@lists.llvm.org"
                        class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a>>
                      wrote:<br class="gmail_msg">
                    </div>
                    <blockquote class="gmail_quote gmail_msg"
                      style="margin:0 0 0 .8ex;border-left:1px #ccc
                      solid;padding-left:1ex">Author: vleschuk<br
                        class="gmail_msg">
                      Date: Sat Feb 25 07:15:57 2017<br
                        class="gmail_msg">
                      New Revision: 296253<br class="gmail_msg">
                      <br class="gmail_msg">
                      URL: <a moz-do-not-send="true"
                        href="http://llvm.org/viewvc/llvm-project?rev=296253&view=rev"
                        rel="noreferrer" class="gmail_msg"
                        target="_blank">http://llvm.org/viewvc/llvm-project?rev=296253&view=rev</a><br
                        class="gmail_msg">
                      Log:<br class="gmail_msg">
                      [DebugInfo] Skip implicit_const attributes when
                      dumping .debug_info. NFC.<br class="gmail_msg">
                      <br class="gmail_msg">
                      When dumping .debug_info section we loop through
                      all attributes mentioned in<br class="gmail_msg">
                      .debug_abbrev section and dump values using
                      DWARFFormValue::extractValue().<br
                        class="gmail_msg">
                      We need to skip implicit_const attributes here as
                      their values are not<br class="gmail_msg">
                      really located in .debug_info but directly in
                      .debug_abbrev. This patch fixes<br
                        class="gmail_msg">
                      triggered assert() in
                      DWARFFormValue::extractValue() caused by trying to<br
                        class="gmail_msg">
                      access implicit_const values from .debug_info.<br
                        class="gmail_msg">
                      <br class="gmail_msg">
                      Modified:<br class="gmail_msg">
                          llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp<br
                        class="gmail_msg">
                      <br class="gmail_msg">
                      Modified:
                      llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp<br
                        class="gmail_msg">
                      URL: <a moz-do-not-send="true"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=296253&r1=296252&r2=296253&view=diff"
                        rel="noreferrer" class="gmail_msg"
                        target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=296253&r1=296252&r2=296253&view=diff</a><br
                        class="gmail_msg">
==============================================================================<br
                        class="gmail_msg">
                      --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
                      (original)<br class="gmail_msg">
                      +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
                      Sat Feb 25 07:15:57 2017<br class="gmail_msg">
                      @@ -329,6 +329,12 @@ void
                      DWARFDie::dump(raw_ostream &OS, uns<br
                        class="gmail_msg">
                      <br class="gmail_msg">
                               // Dump all data in the DIE for the
                      attributes.<br class="gmail_msg">
                               for (const auto &AttrSpec :
                      AbbrevDecl->attributes()) {<br
                        class="gmail_msg">
                      +          if (AttrSpec.Form ==
                      DW_FORM_implicit_const) {<br class="gmail_msg">
                      +            // We are dumping .debug_info section
                      ,<br class="gmail_msg">
                      +            // implicit_const attribute values
                      are not really stored here,<br class="gmail_msg">
                      +            // but in .debug_abbrev section. So
                      we just skip such attrs.<br class="gmail_msg">
                      +            continue;<br class="gmail_msg">
                      +          }<br class="gmail_msg">
                                 dumpAttribute(OS, *this, &offset,
                      AttrSpec.Attr, AttrSpec.Form,<br class="gmail_msg">
                                               Indent);<br
                        class="gmail_msg">
                               }<br class="gmail_msg">
                      <br class="gmail_msg">
                      <br class="gmail_msg">
                      _______________________________________________<br
                        class="gmail_msg">
                      llvm-commits mailing list<br class="gmail_msg">
                      <a moz-do-not-send="true"
                        href="mailto:llvm-commits@lists.llvm.org"
                        class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br
                        class="gmail_msg">
                      <a moz-do-not-send="true"
                        href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
                        rel="noreferrer" class="gmail_msg"
                        target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br
                        class="gmail_msg">
                    </blockquote>
                  </div>
                </blockquote>
                <br class="gmail_msg">
              </div>
              <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                <pre class="m_-7636712434836838175moz-signature gmail_msg" cols="72">-- 
Best Regards,
Victor</pre>
              </div>
            </blockquote>
          </div>
        </div>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Best Regards,
Victor</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Best Regards,
Victor</pre>
  </body>
</html>