[Lldb-commits] [PATCH] symtab.cpp erases while iterating

jingham at apple.com jingham at apple.com
Fri Sep 27 08:50:28 PDT 2013


BTW, bonus points to vc++ for catching this!

Jim

On Sep 27, 2013, at 8:45 AM, jingham at apple.com wrote:

> Presumably you could also fix this just by making the iterator use correct:
> 
> Index: source/Symbol/Symtab.cpp
> ===================================================================
> --- source/Symbol/Symtab.cpp	(revision 191471)
> +++ source/Symbol/Symtab.cpp	(working copy)
> @@ -682,7 +682,7 @@
>             if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
>                 ++pos;
>             else
> -                indexes.erase(pos);
> +                pos = indexes.erase(pos);
>         }
>     }
>     return indexes.size();
> @@ -701,7 +701,7 @@
>             if (symbol_type == eSymbolTypeAny || m_symbols[*pos].GetType() == symbol_type)
>                 ++pos;
>             else
> -                indexes.erase(pos);
> +                pos = indexes.erase(pos);
>         }
>     }
>     return indexes.size();
> 
> We use this idiom in a bunch of places (correctly in all the others I could find...)  I don't actually know how that code worked as originally written.
> 
> Jim
> 
> 
> On Sep 27, 2013, at 1:11 AM, Carlo Kok <ck at remobjects.com> wrote:
> 
>> 
>> 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
>> <symtab_erase_iterator.patch>_______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list