summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp3
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 980a45a2a00..aa400aa7ce7 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -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 *
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index d85ec6429ee..eb2e33b9f45 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -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
(
OpenPOWER on IntegriCloud