[Lldb-commits] [lldb] r147640 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Greg Clayton gclayton at apple.com
Thu Jan 5 16:47:38 PST 2012


Author: gclayton
Date: Thu Jan  5 18:47:38 2012
New Revision: 147640

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

Fixed an issue where the python interpreter could deadlock LLDB.


Modified:
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=147640&r1=147639&r2=147640&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Thu Jan  5 18:47:38 2012
@@ -594,14 +594,26 @@
         break;
 
     case eInputReaderDeactivate:
-        script_interpreter->LeaveSession ();
+			// When another input reader is pushed, don't leave the session...
+            //script_interpreter->LeaveSession ();
         break;
 
     case eInputReaderReactivate:
         {
-            ScriptInterpreterPython::Locker locker(script_interpreter,
-                                                   ScriptInterpreterPython::Locker::AcquireLock | ScriptInterpreterPython::Locker::InitSession,
-                                                   ScriptInterpreterPython::Locker::FreeAcquiredLock);
+            // Don't try and acquire the interpreter lock here because code like
+            // this:
+            //
+            // (lldb) script
+            // >>> v = lldb.frame.EvaluateExpression("collection->get_at_index(12)")
+            //
+            // This will cause the process to run. The interpreter lock is taken
+            // by the input reader for the "script" command. If we try and acquire
+            // the lock here, when the process runs it might deactivate this input
+            // reader (if STDIN is hooked up to the inferior process) and 
+            // reactivate it when the process stops which will deadlock.
+            //ScriptInterpreterPython::Locker locker(script_interpreter,
+            //                                       ScriptInterpreterPython::Locker::AcquireLock | ScriptInterpreterPython::Locker::InitSession,
+            //                                       ScriptInterpreterPython::Locker::FreeAcquiredLock);
         }
         break;
         





More information about the lldb-commits mailing list