Replacing existing uses with AppendError.
SetError is also part of the SBI API. This remains
but instead of calling the underlying SetError it
will call AppendError.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D104768
void SetError(const Status &error, const char *fallback_error_cstr = nullptr);
- void SetError(llvm::StringRef error_cstr);
-
lldb::ReturnStatus GetStatus();
void SetStatus(lldb::ReturnStatus status);
error_cstr);
if (error_cstr)
- ref().SetError(error_cstr);
+ ref().AppendError(error_cstr);
}
namespace lldb_private {
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
if (!m_name_options.m_name.OptionWasSet()) {
- result.SetError("No name option provided.");
+ result.AppendError("No name option provided.");
return false;
}
size_t num_breakpoints = breakpoints.GetSize();
if (num_breakpoints == 0) {
- result.SetError("No breakpoints, cannot add names.");
+ result.AppendError("No breakpoints, cannot add names.");
return false;
}
if (result.Succeeded()) {
if (valid_bp_ids.GetSize() == 0) {
- result.SetError("No breakpoints specified, cannot add names.");
+ result.AppendError("No breakpoints specified, cannot add names.");
return false;
}
size_t num_valid_ids = valid_bp_ids.GetSize();
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
if (!m_name_options.m_name.OptionWasSet()) {
- result.SetError("No name option provided.");
+ result.AppendError("No name option provided.");
return false;
}
size_t num_breakpoints = breakpoints.GetSize();
if (num_breakpoints == 0) {
- result.SetError("No breakpoints, cannot delete names.");
+ result.AppendError("No breakpoints, cannot delete names.");
return false;
}
if (result.Succeeded()) {
if (valid_bp_ids.GetSize() == 0) {
- result.SetError("No breakpoints specified, cannot delete names.");
+ result.AppendError("No breakpoints specified, cannot delete names.");
return false;
}
ConstString bp_name(m_name_options.m_name.GetCurrentValue());
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->Execute(args_string, result);
- result.SetError(GetUnsupportedError());
+ result.AppendError(GetUnsupportedError());
return false;
}
TraceSP trace_sp = process_sp->GetTarget().GetTrace();
if (llvm::Error err = trace_sp->Stop())
- result.SetError(toString(std::move(err)));
+ result.AppendError(toString(std::move(err)));
else
result.SetStatus(eReturnStatusSuccessFinishResult);
return loader;
// This is a soft error because this is expected to fail during capture.
- result.SetError("Not specifying a reproducer is only support during replay.");
+ result.AppendError(
+ "Not specifying a reproducer is only support during replay.");
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return nullptr;
}
auto &r = Reproducer::Instance();
if (!r.IsCapturing() && !r.IsReplaying()) {
- result.SetError(
+ result.AppendError(
"forcing a crash is only supported when capturing a reproducer.");
result.SetStatus(eReturnStatusSuccessFinishNoResult);
return false;
return true;
}
case eReproducerProviderNone:
- result.SetError("No valid provider specified.");
+ result.AppendError("No valid provider specified.");
return false;
}
true /* condense_trivial */, m_options.m_unreported);
// If we didn't find a TID, stop here and return an error.
if (!success) {
- result.SetError("Error dumping plans:");
+ result.AppendError("Error dumping plans:");
result.AppendError(tmp_strm.GetString());
return false;
}
TraceSP trace_sp = process_sp->GetTarget().GetTrace();
if (llvm::Error err = trace_sp->Stop(tids))
- result.SetError(toString(std::move(err)));
+ result.AppendError(toString(std::move(err)));
else
result.SetStatus(eReturnStatusSuccessFinishResult);
trace_sp->GetCursorPosition(*thread_sp)) -
m_consecutive_repetitions * count;
if (position < 0)
- result.SetError("error: no more data");
+ result.AppendError("error: no more data");
else
trace_sp->DumpTraceInstructions(*thread_sp, result.GetOutputStream(),
count, position, m_options.m_raw);
bool DoExecute(Args &command, CommandReturnObject &result) override {
Status error;
if (command.empty()) {
- result.SetError(
+ result.AppendError(
"trace schema cannot be invoked without a plug-in as argument");
return false;
}
bool DoExecute(llvm::StringRef raw_command_line,
CommandReturnObject &result) override {
if (raw_command_line.empty()) {
- result.SetError(
+ result.AppendError(
"type lookup cannot be invoked without a type name as argument");
return false;
}
if (GetFlags().Test(eCommandProcessMustBeTraced)) {
Target *target = m_exe_ctx.GetTargetPtr();
if (target && !target->GetTrace()) {
- result.SetError("Process is not being traced.");
+ result.AppendError("Process is not being traced.");
return false;
}
}
void CommandReturnObject::SetError(const Status &error,
const char *fallback_error_cstr) {
assert(error.Fail() && "Expected a failed Status");
- SetError(error.AsCString(fallback_error_cstr));
-}
-
-void CommandReturnObject::SetError(llvm::StringRef error_str) {
- SetStatus(eReturnStatusFailed);
- AppendError(error_str);
+ AppendError(error.AsCString(fallback_error_cstr));
}
// Similar to AppendError, but do not prepend 'Status: ' to message, and don't