[Lldb-commits] [lldb] r207292 - Free the strong reference to a lldb::SBDebugger that the script interpreter was holding onto in the "lldb.debugger" global variable.
Greg Clayton
gclayton at apple.com
Fri Apr 25 16:55:13 PDT 2014
Author: gclayton
Date: Fri Apr 25 18:55:12 2014
New Revision: 207292
URL: http://llvm.org/viewvc/llvm-project?rev=207292&view=rev
Log:
Free the strong reference to a lldb::SBDebugger that the script interpreter was holding onto in the "lldb.debugger" global variable.
Modified:
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=207292&r1=207291&r2=207292&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Apr 25 18:55:12 2014
@@ -414,6 +414,12 @@ public:
return false;
}
+ virtual void
+ Clear ()
+ {
+ // Clean up any ref counts to SBObjects that might be in global variables
+ }
+
virtual size_t
CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor)
{
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=207292&r1=207291&r2=207292&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Fri Apr 25 18:55:12 2014
@@ -170,6 +170,9 @@ public:
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
std::string& retval);
+ virtual void
+ Clear ();
+
virtual bool
GetDocumentationForItem (const char* item, std::string& dest);
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=207292&r1=207291&r2=207292&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Apr 25 18:55:12 2014
@@ -355,6 +355,9 @@ void
CommandInterpreter::Clear()
{
m_command_io_handler_sp.reset();
+
+ if (m_script_interpreter_ap)
+ m_script_interpreter_ap->Clear();
}
const char *
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=207292&r1=207291&r2=207292&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri Apr 25 18:55:12 2014
@@ -1779,6 +1779,17 @@ ScriptInterpreterPython::GetScriptedSumm
}
+void
+ScriptInterpreterPython::Clear ()
+{
+ // Release any global variables that might have strong references to
+ // LLDB objects when clearing the python script interpreter.
+ Locker locker(this,
+ ScriptInterpreterPython::Locker::AcquireLock,
+ ScriptInterpreterPython::Locker::FreeAcquiredLock);
+ PyRun_SimpleString("lldb.debugger = None; lldb.target = None; lldb.process = None; lldb.thread = None; lldb.frame = None");
+}
+
bool
ScriptInterpreterPython::BreakpointCallbackFunction
(
More information about the lldb-commits
mailing list