[Lldb-commits] [PATCH] D40470: DWZ 03/07: Protect DWARFCompileUnit::m_die_array by a new mutex

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 30 10:52:53 PDT 2018

clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.

Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:335
-    if (keep_compile_unit_die)
+    m_die_array_size_atomic = 0;
+    if (keep_compile_unit_die) {
You can't really play with the m_die_array_size_atomic without locking the mutex, which really means  m_die_array_size_atomic is not very useful. Seems like there is still a race condition:
- thread 1 calls this function and executes "m_die_array.swap(tmp_array);" but not " m_die_array_size_atomic = 0;"
- thread 2 calls DWARFUnit::ExtractDIEsIfNeeded() and calls "already_parsed()" which returns true because m_die_array_size_atomic is still some valid value
- thread 1 clears the DIE array and sets m_die_array_size_atomic to zero
- thread 2 has no DIEs when it tries to use them


More information about the lldb-commits mailing list