1 //===-- ScriptInterpreter.cpp -----------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/Interpreter/ScriptInterpreter.h" 11 12 #include <string> 13 #include <stdlib.h> 14 #include <stdio.h> 15 16 #include "lldb/Core/Error.h" 17 #include "lldb/Core/Stream.h" 18 #include "lldb/Core/StringList.h" 19 #include "lldb/Interpreter/CommandReturnObject.h" 20 #include "lldb/Interpreter/ScriptInterpreterPython.h" 21 #include "lldb/Utility/PseudoTerminal.h" 22 23 using namespace lldb; 24 using namespace lldb_private; 25 26 ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) : 27 m_interpreter (interpreter), 28 m_script_lang (script_lang) 29 { 30 } 31 32 ScriptInterpreter::~ScriptInterpreter () 33 { 34 } 35 36 CommandInterpreter & 37 ScriptInterpreter::GetCommandInterpreter () 38 { 39 return m_interpreter; 40 } 41 42 void 43 ScriptInterpreter::CollectDataForBreakpointCommandCallback 44 ( 45 BreakpointOptions *bp_options, 46 CommandReturnObject &result 47 ) 48 { 49 result.SetStatus (eReturnStatusFailed); 50 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented."); 51 } 52 53 void 54 ScriptInterpreter::CollectDataForWatchpointCommandCallback 55 ( 56 WatchpointOptions *bp_options, 57 CommandReturnObject &result 58 ) 59 { 60 result.SetStatus (eReturnStatusFailed); 61 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented."); 62 } 63 64 std::string 65 ScriptInterpreter::LanguageToString (lldb::ScriptLanguage language) 66 { 67 std::string return_value; 68 69 switch (language) 70 { 71 case eScriptLanguageNone: 72 return_value = "None"; 73 break; 74 case eScriptLanguagePython: 75 return_value = "Python"; 76 break; 77 } 78 79 return return_value; 80 } 81 82 void 83 ScriptInterpreter::InitializeInterpreter (SWIGInitCallback python_swig_init_callback) 84 { 85 #ifndef LLDB_DISABLE_PYTHON 86 ScriptInterpreterPython::InitializeInterpreter (python_swig_init_callback); 87 #endif // #ifndef LLDB_DISABLE_PYTHON 88 } 89 90 void 91 ScriptInterpreter::TerminateInterpreter () 92 { 93 #ifndef LLDB_DISABLE_PYTHON 94 ScriptInterpreterPython::TerminateInterpreter (); 95 #endif // #ifndef LLDB_DISABLE_PYTHON 96 } 97 98