summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-07-15 21:10:17 +0000
committerGreg Clayton <gclayton@apple.com>2013-07-15 21:10:17 +0000
commit109f86860ae46f8a502760d5f21a580b109e8537 (patch)
tree07d6f97b6d6f75fae6f37516981e76ad401f581a /lldb/source/Plugins/SymbolFile
parent8ac2ec4043b39392e26f4d7be818b2b0a257d501 (diff)
downloadbcm5719-llvm-109f86860ae46f8a502760d5f21a580b109e8537.tar.gz
bcm5719-llvm-109f86860ae46f8a502760d5f21a580b109e8537.zip
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. llvm-svn: 186347
Diffstat (limited to 'lldb/source/Plugins/SymbolFile')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp10
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp8
2 files changed, 18 insertions, 0 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 7b3a6cba176..79cf0a1cd4f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -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;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
index 7d265beaab7..abf69190c93 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
@@ -82,7 +82,15 @@ DWARFDeclContext::operator==(const DWARFDeclContext& rhs) const
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)
OpenPOWER on IntegriCloud