[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_type. LLDB, when it finds a forward declaration, would try and find and parse the complete type. It does this by:
Greg Clayton
gclayton at apple.com
Mon Jul 15 14:10:17 PDT 2013
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/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=186347&r1=186346&r2=186347&view=diff
==============================================================================
--- 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/SymbolFile/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)
More information about the lldb-commits
mailing list