[Lldb-commits] [PATCH] D45497: Don't assume the backing thread shares a Protocol ID

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 10 11:44:46 PDT 2018

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

Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:1826-1827
+        for (size_t i = 0; i < num_threads; ++i) {
+          ThreadSP mem_thread = m_thread_list.GetThreadAtIndex(i, false);
+          if (mem_thread && mem_thread->GetBackingThread() == thread_sp)
+            thread_sp = mem_thread;
I would add a new function to ThreadList:

ThreadSP ThreadList::GetBackingThread(const ThreadSP &real_thread);

Since there is a mutex inside the thread list, we don't want another thread to be able to mutate the thread list while doing this iteration. So this code would become:

ThreadSP memory_thread_sp = m_thread_list.GetBackingThread(thread_sp);
if (memory_thread_sp)
  thread_sp = memory_thread_sp;



More information about the lldb-commits mailing list