aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/ScriptInterpreter.cpp
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-02-18 11:31:10 +0100
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-01 21:13:31 +0100
commit182f0d1a34419445bb19d67581d6ac1afc98b7fa (patch)
treebe67a8f0eb71fed8232c17db34350aa069024af3 /lldb/source/Interpreter/ScriptInterpreter.cpp
parentd62a53aaf1d38a55d1affbd3a30d564a4e9d3171 (diff)
downloadllvm-182f0d1a34419445bb19d67581d6ac1afc98b7fa.zip
llvm-182f0d1a34419445bb19d67581d6ac1afc98b7fa.tar.gz
llvm-182f0d1a34419445bb19d67581d6ac1afc98b7fa.tar.bz2
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and more specifically, to the ScriptInterpreterPython. This interface will be used in the C++ `ScriptProcess` Process Plugin to call the script methods. At the moment, not all methods are implemented, they will upstreamed in upcoming patches. This patch also adds helper methods to the ScriptInterpreter to convert `SBAPI` Types (SBData & SBError) to `lldb_private` types (DataExtractor & Status). rdar://65508855 Differential Revision: https://reviews.llvm.org/D95711 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreter.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index 2c55d08..d822ea2 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -26,9 +26,12 @@
using namespace lldb;
using namespace lldb_private;
-ScriptInterpreter::ScriptInterpreter(Debugger &debugger,
- lldb::ScriptLanguage script_lang)
- : m_debugger(debugger), m_script_lang(script_lang) {}
+ScriptInterpreter::ScriptInterpreter(
+ Debugger &debugger, lldb::ScriptLanguage script_lang,
+ lldb::ScriptedProcessInterfaceUP scripted_process_interface_up)
+ : m_debugger(debugger), m_script_lang(script_lang),
+ m_scripted_process_interface_up(
+ std::move(scripted_process_interface_up)) {}
void ScriptInterpreter::CollectDataForBreakpointCommandCallback(
std::vector<BreakpointOptions *> &bp_options_vec,
@@ -69,6 +72,19 @@ std::string ScriptInterpreter::LanguageToString(lldb::ScriptLanguage language) {
llvm_unreachable("Unhandled ScriptInterpreter!");
}
+lldb::DataExtractorSP
+ScriptInterpreter::GetDataExtractorFromSBData(const lldb::SBData &data) const {
+ return data.m_opaque_sp;
+}
+
+Status
+ScriptInterpreter::GetStatusFromSBError(const lldb::SBError &error) const {
+ if (error.m_opaque_up)
+ return *error.m_opaque_up.get();
+
+ return Status();
+}
+
lldb::ScriptLanguage
ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) {
if (language.equals_lower(LanguageToString(eScriptLanguageNone)))