aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h')
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
index 01dc07b49737..4d0645d18aca 100644
--- a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
+++ b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -113,8 +113,25 @@ protected:
return {object};
}
+ python::PythonObject Transform(bool arg) {
+ // Boolean arguments need to be turned into python objects.
+ return python::PythonBoolean(arg);
+ }
+
python::PythonObject Transform(Status arg) {
- return python::ToSWIGWrapper(arg);
+ return python::SWIGBridge::ToSWIGWrapper(arg);
+ }
+
+ python::PythonObject Transform(lldb::ProcessAttachInfoSP arg) {
+ return python::SWIGBridge::ToSWIGWrapper(arg);
+ }
+
+ python::PythonObject Transform(lldb::ProcessLaunchInfoSP arg) {
+ return python::SWIGBridge::ToSWIGWrapper(arg);
+ }
+
+ python::PythonObject Transform(lldb::DataExtractorSP arg) {
+ return python::SWIGBridge::ToSWIGWrapper(arg);
}
template <typename T, typename U>
@@ -129,6 +146,19 @@ protected:
original_arg = ExtractValueFromPythonObject<T>(transformed_arg, error);
}
+
+ void ReverseTransform(bool &original_arg,
+ python::PythonObject transformed_arg, Status &error) {
+ python::PythonBoolean boolean_arg = python::PythonBoolean(
+ python::PyRefType::Borrowed, transformed_arg.get());
+ if (boolean_arg.IsValid())
+ original_arg = boolean_arg.GetValue();
+ else
+ error.SetErrorString(
+ llvm::formatv("{}: Invalid boolean argument.", LLVM_PRETTY_FUNCTION)
+ .str());
+ }
+
template <std::size_t... I, typename... Args>
auto TransformTuple(const std::tuple<Args...> &args,
std::index_sequence<I...>) {
@@ -199,6 +229,19 @@ Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
python::PythonObject &p, Status &error);
template <>
+lldb::BreakpointSP
+ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::BreakpointSP>(
+ python::PythonObject &p, Status &error);
+
+template <>
+lldb::ProcessAttachInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
+ lldb::ProcessAttachInfoSP>(python::PythonObject &p, Status &error);
+
+template <>
+lldb::ProcessLaunchInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
+ lldb::ProcessLaunchInfoSP>(python::PythonObject &p, Status &error);
+
+template <>
lldb::DataExtractorSP
ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
python::PythonObject &p, Status &error);