<div dir="ltr">Just to be clear, I definitely think it should be fixed on the LLDB side, because even if it were fixed in clang, you still have to deal with old debug info.  I just want to make sure that it's also fixed in clang, which it sounds like you said you did file a bug against.  So I wasn't really saying "why bother working around this", because obviously like you said you have no choice.  Just wanted to make sure it didn't go unnoticed by the people on the clang side is all.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Apr 29, 2016 at 2:49 PM Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course we filed a bug about this, and I'm pretty sure Adrian is done or close to done with the fix.<br>
<br>
Searching for a useful interpretation to your question all I can come up with is: "Why are you bothering to work around this rather than fixing clang."  That is actually worth answering, since it may not be obvious that it is very common for debug information to get archived for symbolication of crashes, regression, etc.  So if a bug has been in the compiler for a while, the debugger has to do its best to deal with it.  Expecting somewhat stinky debug information is a sad but true fact of supporting a debugger...<br>
<br>
Jim<br>
<br>
> On Apr 29, 2016, at 2:36 PM, Zachary Turner via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
><br>
> If clang is generating bad debug info, do you think you should file a bug against clang for that?<br>
><br>
> On Fri, Apr 29, 2016 at 2:32 PM Greg Clayton via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
> Author: gclayton<br>
> Date: Fri Apr 29 16:26:46 2016<br>
> New Revision: 268110<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268110&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=268110&view=rev</a><br>
> Log:<br>
> Watch out for compilers that generate bad bitfield info. If the bit size of a bitfield member doesn't lie within the bit bounds of the type itself, just leave it out so we don't get clang asserting and killing our IDE when it gets unhappy with the information.<br>
><br>
> <a href="https://llvm.org/bugs/show_bug.cgi?id=27515" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=27515</a><br>
> <rdar://problem/21082998><br>
><br>
><br>
> Modified:<br>
>     lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py<br>
>     lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp<br>
><br>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py?rev=268110&r1=268109&r2=268110&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py?rev=268110&r1=268109&r2=268110&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py (original)<br>
> +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py Fri Apr 29 16:26:46 2016<br>
> @@ -22,7 +22,6 @@ class BitfieldsTestCase(TestBase):<br>
><br>
>      @skipIfWindows # BitFields exhibit crashes in record layout on Windows (<a href="http://llvm.org/pr21800" rel="noreferrer" target="_blank">http://llvm.org/pr21800</a>)<br>
>      @skipIf("<a href="http://llvm.org/pr27510" rel="noreferrer" target="_blank">llvm.org/pr27510</a>", oslist=["linux"], compiler="clang", compiler_version=[">=", "3.9"]) # expectedFailure, skip to avoid crash<br>
> -    @skipIf("<a href="http://llvm.org/pr27515" rel="noreferrer" target="_blank">llvm.org/pr27515</a>", oslist=["macosx"]) # Assertion failed: (Offset >= Size), function insertPadding CGRecordLayoutBuilder.cpp<br>
>      def test_and_run_command(self):<br>
>          """Test 'frame variable ...' on a variable with bitfields."""<br>
>          self.build()<br>
><br>
> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=268110&r1=268109&r2=268110&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=268110&r1=268109&r2=268110&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)<br>
> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Apr 29 16:26:46 2016<br>
> @@ -2645,6 +2645,10 @@ DWARFASTParserClang::ParseChildMembers(c<br>
>      if (!parent_die)<br>
>          return 0;<br>
><br>
> +    // Get the parent byte size so we can verify any members will fit<br>
> +    const uint64_t parent_byte_size = parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX) * 8;<br>
> +    const uint64_t parent_bit_size = parent_byte_size == UINT64_MAX ? UINT64_MAX : parent_byte_size * 8;<br>
> +<br>
>      uint32_t member_idx = 0;<br>
>      BitfieldInfo last_field_info;<br>
><br>
> @@ -2890,10 +2894,23 @@ DWARFASTParserClang::ParseChildMembers(c<br>
>                                      if (byte_size == 0)<br>
>                                          byte_size = member_type->GetByteSize();<br>
><br>
> -                                    if (die.GetDWARF()->GetObjectFile()->GetByteOrder() == eByteOrderLittle)<br>
> +                                    ObjectFile *objfile = die.GetDWARF()->GetObjectFile();<br>
> +                                    if (objfile->GetByteOrder() == eByteOrderLittle)<br>
>                                      {<br>
>                                          this_field_info.bit_offset += byte_size * 8;<br>
>                                          this_field_info.bit_offset -= (bit_offset + bit_size);<br>
> +<br>
> +                                        if (this_field_info.bit_offset >= parent_bit_size)<br>
> +                                        {<br>
> +                                            objfile->GetModule()->ReportWarning("0x%8.8" PRIx64 ": %s bitfield named \"%s\" has invalid bit offset (0x%8.8" PRIx64 ") member will be ignored. Please file a bug against the compiler and include the preprocessed output for %s\n",<br>
> +                                                                                die.GetID(),<br>
> +                                                                                DW_TAG_value_to_name(tag),<br>
> +                                                                                name,<br>
> +                                                                                this_field_info.bit_offset,<br>
> +                                                                                sc.comp_unit ? sc.comp_unit->GetPath().c_str() : "the source file");<br>
> +                                            this_field_info.Clear();<br>
> +                                            continue;<br>
> +                                        }<br>
>                                      }<br>
>                                      else<br>
>                                      {<br>
><br>
><br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
<br>
</blockquote></div>