summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-10-09 12:43:08 +0000
committerTamas Berghammer <tberghammer@google.com>2015-10-09 12:43:08 +0000
commit69d0b330dd8eb7cb9a55bd8f32902151c19c4f08 (patch)
tree9153dfdfa4dd81faf6245b42ad721882c5ab60fc /lldb/source/Plugins
parent3a6b82b6056dc53cba2c055a73bc9c56b0cae27a (diff)
downloadbcm5719-llvm-69d0b330dd8eb7cb9a55bd8f32902151c19c4f08.tar.gz
bcm5719-llvm-69d0b330dd8eb7cb9a55bd8f32902151c19c4f08.zip
Fix a crash, an UB and add some assert to dwo symbol file handling
llvm-svn: 249827
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h3
4 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index cbd31a549e9..1c1369a6341 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -772,6 +772,10 @@ DWARFASTParserClang::ParseTypeFromDWARF (const SymbolContext& sc,
// will automatically call the SymbolFile virtual function
// "SymbolFileDWARF::CompleteType(Type *)"
// When the definition needs to be defined.
+ assert(!dwarf->GetForwardDeclClangTypeToDie().count(ClangASTContext::RemoveFastQualifiers(clang_type).GetOpaqueQualType()) &&
+ "Type already in the forward declaration map!");
+ assert(((SymbolFileDWARF*)m_ast.GetSymbolFile())->UserIDMatches(die.GetDIERef().GetUID()) &&
+ "Adding incorrect type to forward declaration map");
dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] = clang_type.GetOpaqueQualType();
dwarf->GetForwardDeclClangTypeToDie()[ClangASTContext::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] = die.GetDIERef();
m_ast.SetHasExternalStorage (clang_type.GetOpaqueQualType(), true);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5b2de703635..e9cbd8cde72 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1555,6 +1555,8 @@ SymbolFileDWARF::CompleteType (CompilerType &compiler_type)
DWARFDebugInfo* debug_info = DebugInfo();
DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
+ assert(UserIDMatches(die_it->getSecond().GetUID()) && "CompleteType called on the wrong SymbolFile");
+
// Once we start resolving this type, remove it from the forward declaration
// map in case anyone child members or other types require this type to get resolved.
// The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ba6b5803ea2..60c281caa9d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -125,3 +125,9 @@ SymbolFileDWARFDwo::GetLocationListFormat() const
{
return DWARFExpression::SplitDwarfLocationList;
}
+
+TypeSystem*
+SymbolFileDWARFDwo::GetTypeSystemForLanguage(LanguageType language)
+{
+ return GetBaseSymbolFile()->GetTypeSystemForLanguage(language);
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 3a65509a6a7..8214496b089 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -41,6 +41,9 @@ public:
lldb_private::DWARFExpression::LocationListFormat
GetLocationListFormat() const override;
+ lldb_private::TypeSystem*
+ GetTypeSystemForLanguage(lldb::LanguageType language) override;
+
protected:
DIEToTypePtr&
GetDIEToType() override;
OpenPOWER on IntegriCloud