Symtab.cpp in lldb erases entries while iterating through the list. While this is fine in gcc/clang vc++ asserts on it. Attached patch fixes it.


There's another bit of code concerns me in SymbolFileDWARFDebugMap.cpp:

TimeValue oso_mod_time (oso_file.GetModificationTime());
if (oso_mod_time != comp_unit_info->oso_mod_time)

here it compares the file date with the comp_unit_info. This check fails if the object files are copied to another computer for debugging, or even accessed over a mapped drive. For my local copy I just removed the check though obviously that's not the solution.

--
Carlo Kok
RemObjects Software
Index: C:/Projects/oxygene-nougat-llvm/lldb/source/Symbol/Symtab.cpp
===================================================================
--- C:/Projects/oxygene-nougat-llvm/lldb/source/Symbol/Symtab.cpp       
(revision 191382)
+++ C:/Projects/oxygene-nougat-llvm/lldb/source/Symbol/Symtab.cpp       
(working copy)
@@ -676,14 +676,11 @@
 
     if (AppendSymbolIndexesWithName(symbol_name, indexes) > 0)
     {
-        std::vector<uint32_t>::iterator pos = indexes.begin();
-        while (pos != indexes.end())
-        {
-            if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == 
symbol_type)
-                ++pos;
-            else
-                indexes.erase(pos);
-        }
+        for (int i = indexes.size()-1; i>= 0; i -- )
+        {
+            if (!(symbol_type == eSymbolTypeAny || 
m_symbols[indexes[i]].GetType() == symbol_type))
+                indexes.erase(indexes.begin() + i);
+        }     
     }
     return indexes.size();
 }
@@ -695,14 +692,11 @@
 
     if (AppendSymbolIndexesWithName(symbol_name, symbol_debug_type, 
symbol_visibility, indexes) > 0)
     {
-        std::vector<uint32_t>::iterator pos = indexes.begin();
-        while (pos != indexes.end())
-        {
-            if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == 
symbol_type)
-                ++pos;
-            else
-                indexes.erase(pos);
-        }
+        for (int i = indexes.size() - 1; i>= 0; i -- )
+        {
+            if (!(symbol_type == eSymbolTypeAny || 
m_symbols[indexes[i]].GetType() == symbol_type))
+                indexes.erase(indexes.begin() + i);
+        }  
     }
     return indexes.size();
 }
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to