1 //===-- ScriptInterpreter.cpp -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Interpreter/ScriptInterpreter.h"
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/Utility/PseudoTerminal.h"
23 using namespace lldb_private;
25 ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
26 m_interpreter (interpreter),
27 m_script_lang (script_lang)
31 ScriptInterpreter::~ScriptInterpreter ()
36 ScriptInterpreter::GetCommandInterpreter ()
42 ScriptInterpreter::CollectDataForBreakpointCommandCallback
44 std::vector<BreakpointOptions *> &bp_options_vec,
45 CommandReturnObject &result
48 result.SetStatus (eReturnStatusFailed);
49 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented.");
53 ScriptInterpreter::CollectDataForWatchpointCommandCallback
55 WatchpointOptions *bp_options,
56 CommandReturnObject &result
59 result.SetStatus (eReturnStatusFailed);
60 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented.");
64 ScriptInterpreter::LanguageToString (lldb::ScriptLanguage language)
66 std::string return_value;
70 case eScriptLanguageNone:
71 return_value = "None";
73 case eScriptLanguagePython:
74 return_value = "Python";
82 ScriptInterpreter::SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
83 const char *callback_text)
86 for (BreakpointOptions *bp_options : bp_options_vec)
88 return_error = SetBreakpointCommandCallback(bp_options, callback_text);
89 if (return_error.Success())
96 ScriptInterpreter::SetBreakpointCommandCallbackFunction (std::vector<BreakpointOptions *> &bp_options_vec,
97 const char *function_name)
99 for (BreakpointOptions *bp_options : bp_options_vec)
101 SetBreakpointCommandCallbackFunction(bp_options, function_name);
105 std::unique_ptr<ScriptInterpreterLocker>
106 ScriptInterpreter::AcquireInterpreterLock ()
108 return std::unique_ptr<ScriptInterpreterLocker>(new ScriptInterpreterLocker());