[Lldb-commits] [lldb] r124050 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp

Greg Clayton gclayton at apple.com
Sat Jan 22 16:09:32 PST 2011


Author: gclayton
Date: Sat Jan 22 18:09:32 2011
New Revision: 124050

URL: http://llvm.org/viewvc/llvm-project?rev=124050&view=rev
Log:
Fixed a crasher that would happen when we run into malformed DWARF. It is
nice to know about the issue, but we shouldn't crash.


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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=124050&r1=124049&r2=124050&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Sat Jan 22 18:09:32 2011
@@ -12,6 +12,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/Timer.h"
+#include "lldb/Symbol/ObjectFile.h"
 
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
@@ -219,7 +220,17 @@
                 break;  // We are done with this compile unit!
         }
 
-        assert(offset <= GetNextCompileUnitOffset());
+        if (offset > GetNextCompileUnitOffset())
+        {
+            char path[PATH_MAX];
+            ObjectFile *objfile = m_dwarf2Data->GetObjectFile();
+            if (objfile)
+            {
+                objfile->GetFileSpec().GetPath(path, sizeof(path));
+            }
+            fprintf (stderr, "warning: DWARF compile unit extends beyond its bounds cu 0x%8.8x at 0x%8.8x in '%s'\n", GetOffset(), offset, path);
+            break;
+        }
     }
     SetDIERelations();
     return m_die_array.size();





More information about the lldb-commits mailing list