[Lldb-commits] [lldb] r186347 - Fix issues with GCC debugging. GCC emits DWARF in unique ways that LLDB wasn't handling. This fix will fix cases where classes are forward declared using DW_TAG_structure_type and then actually defined using DW_TAG_clas

Thirumurthi, Ashok ashok.thirumurthi at intel.com
Fri Jul 19 09:13:16 PDT 2013


I suspect that the attached patch is the way forwards.  Do you see all 3 xpasses using 4.6.3?
  XPASS: LLDB (gcc-x86_64) :: test_with_dwarf_and_run_command (TestTypeCompletion.TypeCompletionTestCase)
  XPASS: LLDB (gcc-x86_64) :: test_with_dwarf_and_run_command (TestDataFormatterStdList.StdListDataFormatterTestCase)
  XPASS: LLDB (gcc-x86_64) :: test_with_dwarf_and_run_command (TestDataFormatterStdVector.StdVectorDataFormatterTestCase)

I see just the first two with 4.6.3, and StdVector fails on line 193 with llvm.org/pr15301:

runCmd: frame variable strings
output: (string_vect) strings = vector has 3 items {
  [0] = {
    _M_dataplus = {
      _M_p = 0x00000000015d8098 "goofy"
    }
  }
  [1] = {
    _M_dataplus = {
      _M_p = 0x00000000015d80c8 "is"
    }
  }
  [2] = {
    _M_dataplus = {
      _M_p = 0x00000000015d80f8 "smart"
    }
  }
}

Expecting sub string: vector has 4 items
Not matched
FAILURE


As a side note, ICC 13.1 has more failures yet.  DWARF is flexible enough to make robust parsing challenging...

- Ashok

-----Original Message-----
From: Greg Clayton [mailto:gclayton at apple.com] 
Sent: Thursday, July 18, 2013 5:26 PM
To: Thirumurthi, Ashok
Cc: lldb-commits at cs.uiuc.edu
Subject: Re: [Lldb-commits] [lldb] r186347 - Fix issues with GCC debugging. GCC emits DWARF in unique ways that LLDB wasn't handling. This fix will fix cases where classes are forward declared using DW_TAG_structure_type and then actually defined using DW_TAG_clas


On Jul 18, 2013, at 11:52 AM, "Thirumurthi, Ashok" <ashok.thirumurthi at intel.com> wrote:

> Thanks for looking at this one, Greg,
> 
> Say, which version of gcc were you using?  I see 3 xpasses on the gcc buildbot (4.6.2), but I can't reproduce using 4.6.3...

4.6.3




> 
> - Ashok
> 
> -----Original Message-----
> From: lldb-commits-bounces at cs.uiuc.edu 
> [mailto:lldb-commits-bounces at cs.uiuc.edu] On Behalf Of Greg Clayton
> Sent: Monday, July 15, 2013 5:10 PM
> To: lldb-commits at cs.uiuc.edu
> Subject: [Lldb-commits] [lldb] r186347 - Fix issues with GCC debugging. GCC emits DWARF in unique ways that LLDB wasn't handling. This fix will fix cases where classes are forward declared using DW_TAG_structure_type and then actually defined using DW_TAG_class...
> 
> Author: gclayton
> Date: Mon Jul 15 16:10:17 2013
> New Revision: 186347
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=186347&view=rev
> Log:
> Fix issues with GCC debugging. GCC emits DWARF in unique ways that LLDB wasn't handling. This fix will fix cases where classes are forward declared using DW_TAG_structure_type and then actually defined using DW_TAG_class_type. LLDB, when it finds a forward declaration, would try and find and parse the complete type. It does this by:
> 
> 1 - looking up the type basename in the type index
> 2 - iterate through all matches and look for decl contexts 
> (namespace/class hierarchy) that match
> 
> The issue was the decl context matching wasn't watching for DW_TAG_class_type/DW_TAG_structure_type mismatches, and it wasn't also getting the name for DIE's that didn't have a DW_AT_name, but did have a DW_AT_specification that had a name.
> 
> 
> Modified:
>    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
>    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFi
> le/DWARF/DWARFDebugInfoEntry.cpp?rev=186347&r1=186346&r2=186347&view=d
> iff 
> ======================================================================
> ========
> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
> (original)
> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
> +++ Mon Jul 15 16:10:17 2013
> @@ -1475,6 +1475,16 @@ DWARFDebugInfoEntry::GetName
>     DWARFFormValue form_value;
>     if (GetAttributeValue(dwarf2Data, cu, DW_AT_name, form_value))
>         return 
> form_value.AsCString(&dwarf2Data->get_debug_str_data());
> +    else
> +    {
> +        if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value))
> +        {
> +            DWARFCompileUnitSP cu_sp_ptr;
> +            const DWARFDebugInfoEntry* die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(form_value.Reference(cu), &cu_sp_ptr);
> +            if (die)
> +                return die->GetName(dwarf2Data, cu_sp_ptr.get());
> +        }
> +    }
>     return NULL;
> }
> 
> 
> Modified: 
> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFi
> le/DWARF/DWARFDeclContext.cpp?rev=186347&r1=186346&r2=186347&view=diff
> ======================================================================
> ========
> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp 
> (original)
> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp 
> +++ Mon Jul 15 16:10:17 2013
> @@ -82,7 +82,15 @@ DWARFDeclContext::operator==(const DWARF
>     for (pos = begin, rhs_pos = rhs_begin; pos != end; ++pos, ++rhs_pos)
>     {
>         if (pos->tag != rhs_pos->tag)
> +        {
> +            // Check for DW_TAG_structure_type and DW_TAG_class_type as they are often
> +            // used interchangeably in GCC
> +            if (pos->tag == DW_TAG_structure_type && rhs_pos->tag == DW_TAG_class_type)
> +                continue;
> +            if (pos->tag == DW_TAG_class_type && rhs_pos->tag == DW_TAG_structure_type)
> +                continue;
>             return false;
> +        }
>     }
>     // The tags all match, now compare the names
>     for (pos = begin, rhs_pos = rhs_begin; pos != end; ++pos, 
> ++rhs_pos)
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xpasses-r186347.patch
Type: application/octet-stream
Size: 2276 bytes
Desc: xpasses-r186347.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130719/72eee834/attachment.obj>


More information about the lldb-commits mailing list