[Lldb-commits] [lldb] r147350 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: DWARFCompileUnit.h DWARFDebugInfoEntry.cpp

Greg Clayton gclayton at apple.com
Thu Dec 29 11:47:21 PST 2011


Author: gclayton
Date: Thu Dec 29 13:47:20 2011
New Revision: 147350

URL: http://llvm.org/viewvc/llvm-project?rev=147350&view=rev
Log:
<rdar://problem/10551280>

Fixed a crasher that can occur when parsing invalid DWARF.


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=147350&r1=147349&r2=147350&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Thu Dec 29 13:47:20 2011
@@ -150,6 +150,12 @@
     const DWARFDebugAranges &
     GetFunctionAranges ();
 
+    SymbolFileDWARF*
+    GetSymbolFileDWARF () const
+    {
+        return m_dwarf2Data;
+    }
+
 protected:
     SymbolFileDWARF*    m_dwarf2Data;
     const DWARFAbbreviationDeclarationSet *m_abbrevs;

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=147350&r1=147349&r2=147350&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu Dec 29 13:47:20 2011
@@ -124,11 +124,11 @@
     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 @@
 
         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





More information about the lldb-commits mailing list