diff options
author | Greg Clayton <gclayton@apple.com> | 2015-04-07 22:17:41 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-04-07 22:17:41 +0000 |
commit | ab745c2ad865c07f3905482fd071ef36c024713a (patch) | |
tree | 8d01a1a5354618d3f25df18d5d38fa659ee56d74 /lldb/source/Plugins/OperatingSystem/Python | |
parent | 61a5bbf92a25d1f8aa32a09b132f35a6b2a69f26 (diff) | |
download | bcm5719-llvm-ab745c2ad865c07f3905482fd071ef36c024713a.tar.gz bcm5719-llvm-ab745c2ad865c07f3905482fd071ef36c024713a.zip |
Fix stepping a virtual thread when the python operating system was enabled.
The OperatingSystem plug-ins allow code to detect threads in memory and then say "memory thread 0x11111" is backed by the actual thread 1.
You can then single step these virtual threads. A problem arose when thread specific breakpoints were used during thread plans where we would say "set a breakpoint on thread 0x11111" and we would hit the breakpoint on the real thread 1 and the thread IDs wouldn't match and we would get rid of the "stopped at breakpoint" stop info due to this mismatch. Code was added to ensure these events get forwarded and thus allow single stepping a memory thread to work correctly.
Added a test case for this as well.
<rdar://problem/19211770>
llvm-svn: 234364
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python')
-rw-r--r-- | lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index e85020a965c..df847dbb9ce 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -178,11 +178,18 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OS)); - // First thing we have to do is get the API lock, and the run lock. We're going to change the thread - // content of the process, and we're going to use python, which requires the API lock to do it. - // So get & hold that. This is a recursive lock so we can grant it to any Python code called on the stack below us. + // First thing we have to do is to try to get the API lock, and the run lock. + // We're going to change the thread content of the process, and we're going + // to use python, which requires the API lock to do it. + // + // If someone already has the API lock, that is ok, we just want to avoid + // external code from making new API calls while this call is happening. + // + // This is a recursive lock so we can grant it to any Python code called on + // the stack below us. Target &target = m_process->GetTarget(); - Mutex::Locker api_locker (target.GetAPIMutex()); + Mutex::Locker api_locker; + api_locker.TryLock(target.GetAPIMutex()); if (log) log->Printf ("OperatingSystemPython::UpdateThreadList() fetching thread data from python for pid %" PRIu64, m_process->GetID()); |