From 2f88aadff1276ea99569657b8424776167ec5a34 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Fri, 14 Jan 2011 00:29:16 +0000 Subject: 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. llvm-svn: 123415 --- lldb/source/Interpreter/CommandObjectScript.cpp | 27 +++---------------------- 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'lldb/source/Interpreter/CommandObjectScript.cpp') diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp index 8d9f3362473..70a4eadda2f 100644 --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/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 @@ CommandObjectScript::CommandObjectScript (CommandInterpreter &interpreter, Scrip "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 []"), - m_script_lang (script_lang), - m_interpreter_ap () + m_script_lang (script_lang) { } @@ -48,7 +46,7 @@ CommandObjectScript::ExecuteRawCommandString CommandReturnObject &result ) { - ScriptInterpreter *script_interpreter = GetInterpreter (); + ScriptInterpreter *script_interpreter = m_interpreter.GetScriptInterpreter (); if (script_interpreter == NULL) { @@ -88,22 +86,3 @@ CommandObjectScript::Execute 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(); -} -- cgit v1.2.3