aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/Interfaces')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp19
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h7
2 files changed, 14 insertions, 12 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
index 699412e..a8e1d09 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
@@ -48,7 +48,8 @@ Status ScriptedPythonInterface::ExtractValueFromPythonObject<Status>(
if (lldb::SBError *sb_error = reinterpret_cast<lldb::SBError *>(
python::LLDBSWIGPython_CastPyObjectToSBError(p.get())))
return m_interpreter.GetStatusFromSBError(*sb_error);
- error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+ error =
+ Status::FromErrorString("Couldn't cast lldb::SBError to lldb::Status.");
return {};
}
@@ -59,7 +60,8 @@ Event *ScriptedPythonInterface::ExtractValueFromPythonObject<Event *>(
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.");
+ error = Status::FromErrorString(
+ "Couldn't cast lldb::SBEvent to lldb_private::Event.");
return nullptr;
}
@@ -71,7 +73,8 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::StreamSP>(
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.");
+ error = Status::FromErrorString(
+ "Couldn't cast lldb::SBStream to lldb_private::Stream.");
return nullptr;
}
@@ -84,7 +87,7 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::DataExtractorSP>(
python::LLDBSWIGPython_CastPyObjectToSBData(p.get()));
if (!sb_data) {
- error.SetErrorString(
+ error = Status::FromErrorStringWithFormat(
"Couldn't cast lldb::SBData to lldb::DataExtractorSP.");
return nullptr;
}
@@ -100,7 +103,7 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<lldb::BreakpointSP>(
python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(p.get()));
if (!sb_breakpoint) {
- error.SetErrorString(
+ error = Status::FromErrorStringWithFormat(
"Couldn't cast lldb::SBBreakpoint to lldb::BreakpointSP.");
return nullptr;
}
@@ -115,7 +118,7 @@ lldb::ProcessAttachInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(p.get()));
if (!sb_attach_info) {
- error.SetErrorString(
+ error = Status::FromErrorStringWithFormat(
"Couldn't cast lldb::SBAttachInfo to lldb::ProcessAttachInfoSP.");
return nullptr;
}
@@ -130,7 +133,7 @@ lldb::ProcessLaunchInfoSP ScriptedPythonInterface::ExtractValueFromPythonObject<
python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(p.get()));
if (!sb_launch_info) {
- error.SetErrorString(
+ error = Status::FromErrorStringWithFormat(
"Couldn't cast lldb::SBLaunchInfo to lldb::ProcessLaunchInfoSP.");
return nullptr;
}
@@ -148,7 +151,7 @@ ScriptedPythonInterface::ExtractValueFromPythonObject<
python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(p.get()));
if (!sb_mem_reg_info) {
- error.SetErrorString(
+ error = Status::FromErrorStringWithFormat(
"Couldn't cast lldb::SBMemoryRegionInfo to lldb::MemoryRegionInfoSP.");
return {};
}
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index e1a3156..cbb6cd4 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -269,7 +269,7 @@ protected:
transformed_args);
if (llvm::Error e = expected_return_object.takeError()) {
- error.SetErrorString(llvm::toString(std::move(e)).c_str());
+ error = Status(std::move(e));
return ErrorWithMessage<T>(caller_signature,
"Python method could not be called.", error);
}
@@ -368,9 +368,8 @@ protected:
if (boolean_arg.IsValid())
original_arg = boolean_arg.GetValue();
else
- error.SetErrorString(
- llvm::formatv("{}: Invalid boolean argument.", LLVM_PRETTY_FUNCTION)
- .str());
+ error = Status::FromErrorStringWithFormatv(
+ "{}: Invalid boolean argument.", LLVM_PRETTY_FUNCTION);
}
template <std::size_t... I, typename... Args>