Free the strong reference to a lldb::SBDebugger that the script interpreter was holding onto in the "lldb.debugger" global variable.

llvm-svn: 207292
This commit is contained in:
Greg Clayton 2014-04-25 23:55:12 +00:00
parent 363b570d2a
commit ed6499fe64
4 changed files with 23 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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 *

View File

@ -1779,6 +1779,17 @@ ScriptInterpreterPython::GetScriptedSummary (const char *python_function_name,
}
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
(