diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-13 11:31:34 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-13 11:31:34 +0000 |
commit | 8db3f7ede6e89a70fc4860d5821d5e115450e33b (patch) | |
tree | 7cddd523703f4a7790130eca692e83bb69bd6564 /lldb/source/Target/ThreadList.cpp | |
parent | cf124bd828dfc071130a311eb8a4ea4ae2cd0cdf (diff) | |
download | bcm5719-llvm-8db3f7ede6e89a70fc4860d5821d5e115450e33b.tar.gz bcm5719-llvm-8db3f7ede6e89a70fc4860d5821d5e115450e33b.zip |
Re-land "Don't assume backing thread shares protocol ID."
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.
Differential revision: https://reviews.llvm.org/D45497
rdar://36485830
The original revision (r329891) was reverted because the associated
tests ran into a deadlock on the Linux bots. That problem was resolved
by r330002.
llvm-svn: 330005
Diffstat (limited to 'lldb/source/Target/ThreadList.cpp')
-rw-r--r-- | lldb/source/Target/ThreadList.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index 4cf8f9061a8..61483914644 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -195,6 +195,20 @@ ThreadSP ThreadList::GetThreadSPForThreadPtr(Thread *thread_ptr) { return thread_sp; } +ThreadSP ThreadList::GetBackingThread(const ThreadSP &real_thread) { + std::lock_guard<std::recursive_mutex> guard(GetMutex()); + + ThreadSP thread_sp; + const uint32_t num_threads = m_threads.size(); + for (uint32_t idx = 0; idx < num_threads; ++idx) { + if (m_threads[idx]->GetBackingThread() == real_thread) { + thread_sp = m_threads[idx]; + break; + } + } + return thread_sp; +} + ThreadSP ThreadList::FindThreadByIndexID(uint32_t index_id, bool can_update) { std::lock_guard<std::recursive_mutex> guard(GetMutex()); |