summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/OperatingSystem/Python
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-03-28 00:27:30 +0000
committerEnrico Granata <egranata@apple.com>2013-03-28 00:27:30 +0000
commit198125a8ff9174b3f7fe38d7c031f3cc377f1884 (patch)
treec55ae9aaea399752f77bb7154284add2a3d6c84c /lldb/source/Plugins/OperatingSystem/Python
parent5cb9a184e084cb46ded0f1992a57a0f9cbe4a82e (diff)
downloadbcm5719-llvm-198125a8ff9174b3f7fe38d7c031f3cc377f1884.tar.gz
bcm5719-llvm-198125a8ff9174b3f7fe38d7c031f3cc377f1884.zip
<rdar://problem/13412986>
Holding the Python lock while we call the Python C API to post-process objects returned from the OS plugins This should avoid issues where some Python objects get invalidated while we are in the middle of processing them and we end up with an invalid Python state and a crash llvm-svn: 178206
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python')
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 2f9c69870f3..c80b88cd821 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -186,6 +186,7 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, ThreadList
if (log)
log->Printf ("OperatingSystemPython::UpdateThreadList() fetching thread data from python for pid %" PRIu64, m_process->GetID());
+ auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive
PythonList threads_list(m_interpreter->OSPlugin_ThreadsInfo(m_python_object_sp));
if (threads_list)
{
@@ -269,6 +270,7 @@ OperatingSystemPython::CreateRegisterContextForThread (Thread *thread, addr_t re
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure python objects stays alive
if (reg_data_addr != LLDB_INVALID_ADDRESS)
{
// The registers data is in contiguous memory, just create the register
@@ -329,6 +331,7 @@ OperatingSystemPython::CreateThread (lldb::tid_t tid, addr_t context)
Target &target = m_process->GetTarget();
Mutex::Locker api_locker (target.GetAPIMutex());
+ auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure thread_info_dict stays alive
PythonDictionary thread_info_dict (m_interpreter->OSPlugin_CreateThread(m_python_object_sp, tid, context));
if (thread_info_dict)
{
OpenPOWER on IntegriCloud