<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Ok than, will fix, provide tests and submit to phab.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 02/27/2017 10:21 PM, Eric
      Christopher wrote:<br>
    </div>
    <blockquote
cite="mid:CALehDX4QoE5ry2ueaX+D1nSwUTQHP9Z9wkK60sc1096PtvWJDg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">FWIW I agree completely with Dave here. We should
        show the constness of the data explicitly in the dump.
        <div><br>
        </div>
        <div>Thanks!</div>
        <div><br>
        </div>
        <div>-eric</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Mon, Feb 27, 2017 at 11:13 AM David Blaikie
          <<a moz-do-not-send="true" href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr" class="gmail_msg">I tend to think it's more
            legible if we include the values there, even if no bytes
            were required to produce them. I don't generally look at the
            abbreviations when reading a dump & expect to see the
            data in the debug_info/debug_types output.<br
              class="gmail_msg">
            <br class="gmail_msg">
            ( <a moz-do-not-send="true"
              class="m_3395721182541375228GWVZpf m_3395721182541375228gW
              gmail_msg" id="m_3395721182541375228IloFPc-3"
              href="mailto:aprantl@apple.com" target="_blank">+Adrian
              Prantl</a>  <a moz-do-not-send="true"
              class="m_3395721182541375228GWVZpf m_3395721182541375228gW
              gmail_msg" id="m_3395721182541375228IloFPc-2"
              href="mailto:echristo@gmail.com" target="_blank">+Eric
              Christopher</a> in case they've got thoughts on the
            subject)</div>
          <div dir="ltr" class="gmail_msg"><br class="gmail_msg">
            <br class="gmail_msg">
            <div class="gmail_quote gmail_msg">
              <div dir="ltr" class="gmail_msg">On Mon, Feb 27, 2017 at
                11:09 AM Victor Leschuk <<a moz-do-not-send="true"
                  href="mailto:vleschuk@accesssoftek.com"
                  class="gmail_msg" target="_blank">vleschuk@accesssoftek.com</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">
                <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                  <p class="gmail_msg">Yeah, I see, I was wrong. I agree
                    that we need to make behavior uniform here. However
                    I still think we shouldn't include the data which is
                    not really present into dump. It seems more logical
                    for me to not print flag_present values either.</p>
                  <p class="gmail_msg">What do you think?</p>
                </div>
                <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                  <div
                    class="m_3395721182541375228m_-1917743091071114938moz-cite-prefix
                    gmail_msg">On 02/27/2017 09:54 PM, David Blaikie
                    wrote:<br class="gmail_msg">
                  </div>
                  <blockquote type="cite" class="gmail_msg">
                    <div dir="ltr" class="gmail_msg"><br
                        class="gmail_msg">
                      <br class="gmail_msg">
                      <div class="gmail_quote gmail_msg">
                        <div dir="ltr" class="gmail_msg">On Mon, Feb 27,
                          2017 at 10:30 AM Victor Leschuk <<a
                            moz-do-not-send="true"
                            href="mailto:vleschuk@accesssoftek.com"
                            class="gmail_msg" target="_blank">vleschuk@accesssoftek.com</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">
                          <div bgcolor="#FFFFFF" text="#000000"
                            class="gmail_msg">
                            <p class="gmail_msg">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,</p>
                          </div>
                        </blockquote>
                        <div class="gmail_msg"><br class="gmail_msg">
                          I think one of us is confused, because my
                          understanding is that flag_present attributes
                          do not have any bit/bytes in the debug_info
                          representation.<br class="gmail_msg">
                          <br class="gmail_msg">
                          To take the same example as before and look at
                          the assembly:<br class="gmail_msg">
                          <br class="gmail_msg">
                          this is the debug_info assembly for that
                          subprogram:<br class="gmail_msg">
                          <font class="gmail_msg" face="monospace"><br
                              class="gmail_msg">
                          </font>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   2        
                                            # Abbrev [2] 0x2a:0x19
                              DW_TAG_subprogram</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .quad  
                              .Lfunc_begin0           # DW_AT_low_pc</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .long  
                              .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   1        
                                            # DW_AT_frame_base</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   86</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .long  
                              .Linfo_string3          #
                              DW_AT_linkage_name</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .long  
                              .Linfo_string4          # DW_AT_name</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   1        
                                            # DW_AT_decl_file</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   1        
                                            # DW_AT_decl_line</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">                         
                                            # DW_AT_external</font></div>
                          <div class="gmail_msg"><font class="gmail_msg"
                              face="monospace">        .byte   0        
                                            # End Of Children Mark</font></div>
                          <br class="gmail_msg">
                          Note that no bytes were produced for the
                          DW_AT_external (using DW_FORM_flag_present in
                          the abbrev) attribute.<br class="gmail_msg">
                          <br class="gmail_msg">
                          From the DWARF4 spec:<br class="gmail_msg">
                          <br class="gmail_msg">
                          "A flag is represented explicitly as a single
                          byte of data (DW_FORM_flag) or implicitly
                          (DW_FORM_flag_present). In the first case, if
                          the flag has value zero, it indicates the
                          absence of the attribute; if the flag has a
                          non-zero value, it indicates the presence of
                          the attribute. In the second case, the
                          attribute is implicitly indicated as present,
                          and no value is encoded in the debugging
                          information entry itself."<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">
                          <div bgcolor="#FFFFFF" text="#000000"
                            class="gmail_msg">
                            <p class="gmail_msg"> 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
                                class="gmail_msg">
                            </p>
                          </div>
                          <div bgcolor="#FFFFFF" text="#000000"
                            class="gmail_msg"> <br class="gmail_msg">
                            <div
class="m_3395721182541375228m_-1917743091071114938m_-7804286437102967308moz-cite-prefix
                              gmail_msg">On 02/27/2017 09:04 PM, David
                              Blaikie wrote:<br class="gmail_msg">
                            </div>
                            <blockquote type="cite" class="gmail_msg">
                              <div dir="ltr" class="gmail_msg"><br
                                  class="gmail_msg">
                                <br class="gmail_msg">
                                <div class="gmail_quote gmail_msg">
                                  <div dir="ltr" class="gmail_msg">On
                                    Mon, Feb 27, 2017 at 10:00 AM Victor
                                    Leschuk <<a
                                      moz-do-not-send="true"
                                      href="mailto:vleschuk@accesssoftek.com"
                                      class="gmail_msg" target="_blank">vleschuk@accesssoftek.com</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">
                                    <div bgcolor="#FFFFFF"
                                      text="#000000" class="gmail_msg">
                                      <p class="gmail_msg"><br
                                          class="gmail_msg">
                                      </p>
                                      <br class="gmail_msg">
                                      <div
class="m_3395721182541375228m_-1917743091071114938m_-7804286437102967308m_-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 class="gmail_msg"><br
                                      class="gmail_msg">
                                    Looks to me like it is:<br
                                      class="gmail_msg">
                                    <br class="gmail_msg">
                                    dumping debug info for this code:
                                    void f1() { }<br class="gmail_msg">
                                    <br class="gmail_msg">
                                    produces this:<br class="gmail_msg">
                                    <br class="gmail_msg">
                                    <font class="gmail_msg"
                                      face="monospace">  .debug_abbrev
                                      contents:<br class="gmail_msg">
                                        ...<br class="gmail_msg">
                                    </font>
                                    <div class="gmail_msg"><font
                                        class="gmail_msg"
                                        face="monospace">  [2]
                                        DW_TAG_subprogram  
                                        DW_CHILDREN_no</font></div>
                                    <div class="gmail_msg"><font
                                        class="gmail_msg"
                                        face="monospace">          ...</font></div>
                                    <div class="gmail_msg"><font
                                        class="gmail_msg"
                                        face="monospace">         
                                        DW_AT_external
                                         DW_FORM_flag_present<br
                                          class="gmail_msg">
                                        <br class="gmail_msg">
                                          .debug_info contents:<br
                                          class="gmail_msg">
                                          ...<br class="gmail_msg">
                                          0x0000002a:  
                                        DW_TAG_subprogram [2]<br
                                          class="gmail_msg">
                                                          ...<br
                                          class="gmail_msg">
                                                          DW_AT_external
                                        [DW_FORM_flag_present] (true)</font></div>
                                    <br class="gmail_msg">
                                  </div>
                                  <div class="gmail_msg">I would expect
                                    similar behavior for const_value -
                                    that the attribute and its constant
                                    value is printed in the debug_info
                                    dump.<br class="gmail_msg">
                                    <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">
                                    <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_3395721182541375228m_-1917743091071114938m_-7804286437102967308m_-7636712434836838175moz-signature gmail_msg" cols="72">-- 
Best Regards,
Victor</pre>
                                    </div>
                                  </blockquote>
                                </div>
                              </div>
                            </blockquote>
                            <br class="gmail_msg">
                          </div>
                          <div bgcolor="#FFFFFF" text="#000000"
                            class="gmail_msg">
                            <pre class="m_3395721182541375228m_-1917743091071114938m_-7804286437102967308moz-signature gmail_msg" cols="72">-- 
Best Regards,
Victor</pre>
                          </div>
                        </blockquote>
                      </div>
                    </div>
                  </blockquote>
                  <br class="gmail_msg">
                </div>
                <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
                  <pre class="m_3395721182541375228m_-1917743091071114938moz-signature gmail_msg" cols="72">-- 
Best Regards,
Victor</pre>
                </div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Best Regards,
Victor</pre>
  </body>
</html>