aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
index 097cbbd..a38cb10 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
@@ -35,4 +35,31 @@ ScriptedPythonInterface::GetStatusFromMethod(llvm::StringRef method_name) {
return error;
}
+template <>
+Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
+ python::PythonObject &p, Status &error) {
+ if (lldb::SBError *sb_error = reinterpret_cast<lldb::SBError *>(
+ LLDBSWIGPython_CastPyObjectToSBError(p.get())))
+ error = m_interpreter.GetStatusFromSBError(*sb_error);
+ else
+ error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+
+ return error;
+}
+
+template <>
+lldb::DataExtractorSP
+ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
+ python::PythonObject &p, Status &error) {
+ lldb::SBData *sb_data = reinterpret_cast<lldb::SBData *>(
+ LLDBSWIGPython_CastPyObjectToSBData(p.get()));
+
+ if (!sb_data) {
+ error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+ return nullptr;
+ }
+
+ return m_interpreter.GetDataExtractorFromSBData(*sb_data);
+}
+
#endif