summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-12-29 19:47:20 +0000
committerGreg Clayton <gclayton@apple.com>2011-12-29 19:47:20 +0000
commit360f9a7663c88c845d2f723804ac059f3291ebac (patch)
treeda29d729ff5ada45cb39403d3bd43ab6df0bb533
parente1bd05128e0bab1d41155d2ce54b47c0874c46d5 (diff)
downloadbcm5719-llvm-360f9a7663c88c845d2f723804ac059f3291ebac.tar.gz
bcm5719-llvm-360f9a7663c88c845d2f723804ac059f3291ebac.zip
<rdar://problem/10551280>
Fixed a crasher that can occur when parsing invalid DWARF. llvm-svn: 147350
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp13
2 files changed, 17 insertions, 2 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index 4473ce45b47..9591110d15f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -150,6 +150,12 @@ public:
const DWARFDebugAranges &
GetFunctionAranges ();
+ SymbolFileDWARF*
+ GetSymbolFileDWARF () const
+ {
+ return m_dwarf2Data;
+ }
+
protected:
SymbolFileDWARF* m_dwarf2Data;
const DWARFAbbreviationDeclarationSet *m_abbrevs;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 7f4a17e2392..26961f497cb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -124,11 +124,11 @@ DWARFDebugInfoEntry::FastExtract
m_parent_idx = 0;
m_sibling_idx = 0;
m_empty_children = false;
- uint64_t abbr_idx = debug_info_data.GetULEB128 (offset_ptr);
+ const uint64_t abbr_idx = debug_info_data.GetULEB128 (offset_ptr);
assert (abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
m_abbr_idx = abbr_idx;
- assert (fixed_form_sizes); // For best performance this should be specified!
+ //assert (fixed_form_sizes); // For best performance this should be specified!
if (m_abbr_idx)
{
@@ -136,6 +136,15 @@ DWARFDebugInfoEntry::FastExtract
const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(m_abbr_idx);
+ if (abbrevDecl == NULL)
+ {
+ cu->GetSymbolFileDWARF ()->ReportError ("{0x%8.8x}: invalid abbreviation code %u, please file a bug and attach the file at the start of this error message",
+ m_offset,
+ (unsigned)abbr_idx);
+ // WE can't parse anymore if the DWARF is borked...
+ *offset_ptr = UINT32_MAX;
+ return false;
+ }
m_tag = abbrevDecl->Tag();
m_has_children = abbrevDecl->HasChildren();
// Skip all data in the .debug_info for the attributes
OpenPOWER on IntegriCloud