[Lldb-commits] [lldb] r145226 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Sun Nov 27 19:29:03 PST 2011


Author: gclayton
Date: Sun Nov 27 21:29:03 2011
New Revision: 145226

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

Fixed a potential crasher where we weren't checking we got a valid DIE in
a compile unit.


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=145226&r1=145225&r2=145226&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Nov 27 21:29:03 2011
@@ -1007,27 +1007,30 @@
     if (dwarf_cu)
     {
         const DWARFDebugInfoEntry *dwarf_cu_die = dwarf_cu->GetCompileUnitDIEOnly();
-        const dw_offset_t cu_line_offset = dwarf_cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_stmt_list, DW_INVALID_OFFSET);
-        if (cu_line_offset != DW_INVALID_OFFSET)
+        if (dwarf_cu_die)
         {
-            std::auto_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
-            if (line_table_ap.get())
+            const dw_offset_t cu_line_offset = dwarf_cu_die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_stmt_list, DW_INVALID_OFFSET);
+            if (cu_line_offset != DW_INVALID_OFFSET)
             {
-                ParseDWARFLineTableCallbackInfo info = { 
-                    line_table_ap.get(), 
-                    m_obj_file->GetSectionList(), 
-                    0, 
-                    0, 
-                    m_debug_map_symfile != NULL, 
-                    false, 
-                    DWARFDebugLine::Row(), 
-                    SectionSP(), 
-                    SectionSP()
-                };
-                uint32_t offset = cu_line_offset;
-                DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset, ParseDWARFLineTableCallback, &info);
-                sc.comp_unit->SetLineTable(line_table_ap.release());
-                return true;
+                std::auto_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
+                if (line_table_ap.get())
+                {
+                    ParseDWARFLineTableCallbackInfo info = { 
+                        line_table_ap.get(), 
+                        m_obj_file->GetSectionList(), 
+                        0, 
+                        0, 
+                        m_debug_map_symfile != NULL, 
+                        false, 
+                        DWARFDebugLine::Row(), 
+                        SectionSP(), 
+                        SectionSP()
+                    };
+                    uint32_t offset = cu_line_offset;
+                    DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset, ParseDWARFLineTableCallback, &info);
+                    sc.comp_unit->SetLineTable(line_table_ap.release());
+                    return true;
+                }
             }
         }
     }





More information about the lldb-commits mailing list