[Lldb-commits] [lldb] r171901 - in /lldb/trunk/source: API/SBCommandInterpreter.cpp Plugins/Process/Utility/ThreadMemory.cpp

Greg Clayton gclayton at apple.com
Tue Jan 8 13:56:43 PST 2013


Author: gclayton
Date: Tue Jan  8 15:56:43 2013
New Revision: 171901

URL: http://llvm.org/viewvc/llvm-project?rev=171901&view=rev
Log:
<rdar://problem/12586010>

Python OS plug-ins now fetch thread registers lazily.

Also changed SBCommandInterpreter::HandleCommand() to not take the API lock. The logic here is that from the command line you can execute a command that might result in another thread (like the private process thread) to execute python or run any code that can re-enter the public API. When this happens, a deadlock immediately occurs for things like "process launch" and "process attach".


Modified:
    lldb/trunk/source/API/SBCommandInterpreter.cpp
    lldb/trunk/source/Plugins/Process/Utility/ThreadMemory.cpp

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=171901&r1=171900&r2=171901&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Tue Jan  8 15:56:43 2013
@@ -119,10 +119,6 @@
     result.Clear();
     if (command_line && m_opaque_ptr)
     {
-        TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
-        Mutex::Locker api_locker;
-        if (target_sp)
-            api_locker.Lock(target_sp->GetAPIMutex());
         m_opaque_ptr->HandleCommand (command_line, add_to_history ? eLazyBoolYes : eLazyBoolNo, result.ref());
     }
     else

Modified: lldb/trunk/source/Plugins/Process/Utility/ThreadMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/ThreadMemory.cpp?rev=171901&r1=171900&r2=171901&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/ThreadMemory.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/ThreadMemory.cpp Tue Jan  8 15:56:43 2013
@@ -135,7 +135,10 @@
 void
 ThreadMemory::RefreshStateAfterStop()
 {
-    RegisterContextSP reg_ctx_sp(GetRegisterContext());
+    // Don't fetch the registers by calling Thread::GetRegisterContext() below.
+    // We might not have fetched any registers yet and we don't want to fetch
+    // the registers just to call invalidate on them...
+    RegisterContextSP reg_ctx_sp(m_reg_context_sp);
     if (reg_ctx_sp)
     {
         const bool force = true;





More information about the lldb-commits mailing list