[Lldb-commits] [lldb] r178206 - <rdar://problem/13412986>
Enrico Granata
egranata at apple.com
Wed Mar 27 17:27:31 PDT 2013
Author: enrico
Date: Wed Mar 27 19:27:30 2013
New Revision: 178206
URL: http://llvm.org/viewvc/llvm-project?rev=178206&view=rev
Log:
<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
Modified:
lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=178206&r1=178205&r2=178206&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Wed Mar 27 19:27:30 2013
@@ -186,6 +186,7 @@ OperatingSystemPython::UpdateThreadList
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::CreateRegisterCon
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 (lld
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)
{
More information about the lldb-commits
mailing list