diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-12 09:58:20 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-04-12 09:58:20 +0000 |
| commit | 0045c72f9c40192fd6e1905a82dca94ecb1ec8b5 (patch) | |
| tree | 4274f2baa121a554a0bbb9deef12a2615e131438 /lldb/source/Target | |
| parent | 4955c77c2df3e00b96fa71e20aee119ba0d991e9 (diff) | |
| download | bcm5719-llvm-0045c72f9c40192fd6e1905a82dca94ecb1ec8b5.tar.gz bcm5719-llvm-0045c72f9c40192fd6e1905a82dca94ecb1ec8b5.zip | |
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
llvm-svn: 329891
Diffstat (limited to 'lldb/source/Target')
| -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()); |

