Split up the Python script interpreter code to allow multiple script interpreter objects to
exist within the same process (one script interpreter object per debugger object). The
python script interpreter objects are all using the same global Python script interpreter;
they use separate dictionaries to keep their data separate, and mutex's to prevent any object
attempting to use the global Python interpreter when another object is already using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123415 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandObjectScript.cpp b/source/Interpreter/CommandObjectScript.cpp
index 8d9f336..70a4ead 100644
--- a/source/Interpreter/CommandObjectScript.cpp
+++ b/source/Interpreter/CommandObjectScript.cpp
@@ -17,8 +17,7 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
-#include "lldb/Interpreter/ScriptInterpreterNone.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
@@ -32,8 +31,7 @@
"script",
"Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.",
"script [<script-expression-for-evaluation>]"),
- m_script_lang (script_lang),
- m_interpreter_ap ()
+ m_script_lang (script_lang)
{
}
@@ -48,7 +46,7 @@
CommandReturnObject &result
)
{
- ScriptInterpreter *script_interpreter = GetInterpreter ();
+ ScriptInterpreter *script_interpreter = m_interpreter.GetScriptInterpreter ();
if (script_interpreter == NULL)
{
@@ -88,22 +86,3 @@
return false;
}
-
-ScriptInterpreter *
-CommandObjectScript::GetInterpreter ()
-{
- if (m_interpreter_ap.get() == NULL)
- {
- switch (m_script_lang)
- {
- case eScriptLanguagePython:
- m_interpreter_ap.reset (new ScriptInterpreterPython (m_interpreter));
- break;
-
- case eScriptLanguageNone:
- m_interpreter_ap.reset (new ScriptInterpreterNone (m_interpreter));
- break;
- }
- }
- return m_interpreter_ap.get();
-}