summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2024-06-27 16:32:27 -0700
committershawbyoung <shawbyoung@gmail.com>2024-06-27 16:32:27 -0700
commitf5c7df12cacdb84552b36a7ac598a8db41acc680 (patch)
tree3b33e941b9bfb88c40c64fd18ee32a633423cbed /lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
parent608880c3a7a59c86db82728067e553a8d4665a45 (diff)
parent804415825b97e974c96a92580bcbeaf4c7ff0a04 (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/shawbyoung/spr/main.boltnfc-refactoring-callgraph
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
index 6f22503b279c..7d072212676e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
@@ -27,6 +27,15 @@ ScriptedPythonInterface::ScriptedPythonInterface(
: ScriptedInterface(), m_interpreter(interpreter) {}
template <>
+void ScriptedPythonInterface::ReverseTransform(
+ lldb_private::Stream *&original_arg, python::PythonObject transformed_arg,
+ Status &error) {
+ Stream *s = ExtractValueFromPythonObject<Stream *>(transformed_arg, error);
+ *original_arg = *s;
+ original_arg->PutCString(static_cast<StreamString *>(s)->GetData());
+}
+
+template <>
StructuredData::ArraySP
ScriptedPythonInterface::ExtractValueFromPythonObject<StructuredData::ArraySP>(
python::PythonObject &p, Status &error) {
@@ -48,13 +57,34 @@ Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
if (lldb::SBError *sb_error = reinterpret_cast<lldb::SBError *>(
python::LLDBSWIGPython_CastPyObjectToSBError(p.get())))
return m_interpreter.GetStatusFromSBError(*sb_error);
- else
- error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+ error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
return {};
}
template <>
+Event *ScriptedPythonInterface::ExtractValueFromPythonObject<Event *>(
+ python::PythonObject &p, Status &error) {
+ if (lldb::SBEvent *sb_event = reinterpret_cast<lldb::SBEvent *>(
+ python::LLDBSWIGPython_CastPyObjectToSBEvent(p.get())))
+ return m_interpreter.GetOpaqueTypeFromSBEvent(*sb_event);
+ error.SetErrorString("Couldn't cast lldb::SBEvent to lldb_private::Event.");
+
+ return nullptr;
+}
+
+template <>
+Stream *ScriptedPythonInterface::ExtractValueFromPythonObject<Stream *>(
+ python::PythonObject &p, Status &error) {
+ if (lldb::SBStream *sb_stream = reinterpret_cast<lldb::SBStream *>(
+ python::LLDBSWIGPython_CastPyObjectToSBStream(p.get())))
+ return m_interpreter.GetOpaqueTypeFromSBStream(*sb_stream);
+ error.SetErrorString("Couldn't cast lldb::SBStream to lldb_private::Stream.");
+
+ return nullptr;
+}
+
+template <>
lldb::DataExtractorSP
ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
python::PythonObject &p, Status &error) {