JDevlieghere created this revision. JDevlieghere added reviewers: jingham, clayborg.
When we're dealing with virtual (memory) threads created by the OS plugins, there's no guarantee that the real thread and the backing thread share a protocol ID. Instead, we should iterate over the memory threads to find the virtual thread that is backed by the current real thread. rdar://36485830 Repository: rL LLVM https://reviews.llvm.org/D45497 Files: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1820,11 +1820,13 @@ if (!thread_sp->StopInfoIsUpToDate()) { thread_sp->SetStopInfo(StopInfoSP()); // If there's a memory thread backed by this thread, we need to use it - // to calcualte StopInfo. - ThreadSP memory_thread_sp = - m_thread_list.FindThreadByProtocolID(thread_sp->GetProtocolID()); - if (memory_thread_sp) - thread_sp = memory_thread_sp; + // to calculate StopInfo. + size_t num_threads = m_thread_list.GetSize(false); + 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; + } if (exc_type != 0) { const size_t exc_data_size = exc_data.size();
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1820,11 +1820,13 @@ if (!thread_sp->StopInfoIsUpToDate()) { thread_sp->SetStopInfo(StopInfoSP()); // If there's a memory thread backed by this thread, we need to use it - // to calcualte StopInfo. - ThreadSP memory_thread_sp = - m_thread_list.FindThreadByProtocolID(thread_sp->GetProtocolID()); - if (memory_thread_sp) - thread_sp = memory_thread_sp; + // to calculate StopInfo. + size_t num_threads = m_thread_list.GetSize(false); + 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; + } if (exc_type != 0) { const size_t exc_data_size = exc_data.size();
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits