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/lldb-python.h"
12 #include "lldb/Interpreter/ScriptInterpreter.h"
18 #include "lldb/Core/Error.h"
19 #include "lldb/Core/Stream.h"
20 #include "lldb/Core/StringList.h"
21 #include "lldb/Interpreter/CommandReturnObject.h"
22 #include "lldb/Interpreter/ScriptInterpreterPython.h"
23 #include "lldb/Utility/PseudoTerminal.h"
26 using namespace lldb_private;
28 ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
29 m_interpreter (interpreter),
30 m_script_lang (script_lang)
34 ScriptInterpreter::~ScriptInterpreter ()
39 ScriptInterpreter::GetCommandInterpreter ()
45 ScriptInterpreter::CollectDataForBreakpointCommandCallback
47 BreakpointOptions *bp_options,
48 CommandReturnObject &result
51 result.SetStatus (eReturnStatusFailed);
52 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented.");
56 ScriptInterpreter::CollectDataForWatchpointCommandCallback
58 WatchpointOptions *bp_options,
59 CommandReturnObject &result
62 result.SetStatus (eReturnStatusFailed);
63 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented.");
67 ScriptInterpreter::LanguageToString (lldb::ScriptLanguage language)
69 std::string return_value;
73 case eScriptLanguageNone:
74 return_value = "None";
76 case eScriptLanguagePython:
77 return_value = "Python";
84 std::unique_ptr<ScriptInterpreterLocker>
85 ScriptInterpreter::AcquireInterpreterLock ()
87 return std::unique_ptr<ScriptInterpreterLocker>(new ScriptInterpreterLocker());
91 ScriptInterpreter::InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
92 SWIGBreakpointCallbackFunction swig_breakpoint_callback,
93 SWIGWatchpointCallbackFunction swig_watchpoint_callback,
94 SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
95 SWIGPythonCreateSyntheticProvider swig_synthetic_script,
96 SWIGPythonCalculateNumChildren swig_calc_children,
97 SWIGPythonGetChildAtIndex swig_get_child_index,
98 SWIGPythonGetIndexOfChildWithName swig_get_index_child,
99 SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
100 SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
101 SWIGPythonUpdateSynthProviderInstance swig_update_provider,
102 SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
103 SWIGPythonCallCommand swig_call_command,
104 SWIGPythonCallModuleInit swig_call_module_init,
105 SWIGPythonCreateOSPlugin swig_create_os_plugin,
106 SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
107 SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
108 SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
109 SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
110 SWIGPython_GetDynamicSetting swig_plugin_get)
112 #ifndef LLDB_DISABLE_PYTHON
113 ScriptInterpreterPython::InitializeInterpreter (python_swig_init_callback,
114 swig_breakpoint_callback,
115 swig_watchpoint_callback,
116 swig_typescript_callback,
117 swig_synthetic_script,
119 swig_get_child_index,
120 swig_get_index_child,
121 swig_cast_to_sbvalue ,
122 swig_get_valobj_sp_from_sbvalue,
123 swig_update_provider,
124 swig_mighthavechildren_provider,
126 swig_call_module_init,
127 swig_create_os_plugin,
128 swig_run_script_keyword_process,
129 swig_run_script_keyword_thread,
130 swig_run_script_keyword_target,
131 swig_run_script_keyword_frame,
133 #endif // #ifndef LLDB_DISABLE_PYTHON
137 ScriptInterpreter::TerminateInterpreter ()
139 #ifndef LLDB_DISABLE_PYTHON
140 ScriptInterpreterPython::TerminateInterpreter ();
141 #endif // #ifndef LLDB_DISABLE_PYTHON