This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8dd7094d364: [lldb] Remove more redundant
SetStatus(eReturnStatusFailed) (authored by DavidSpickett).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104697/new/
https://reviews.llvm.org/D104697
Files:
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectVersion.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Interpreter/CommandObject.cpp
Index: lldb/source/Interpreter/CommandObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -219,7 +219,6 @@
// A process that is not running is considered paused.
if (GetFlags().Test(eCommandProcessMustBeLaunched)) {
result.AppendError("Process must exist.");
- result.SetStatus(eReturnStatusFailed);
return false;
}
} else {
@@ -239,7 +238,6 @@
case eStateUnloaded:
if (GetFlags().Test(eCommandProcessMustBeLaunched)) {
result.AppendError("Process must be launched.");
- result.SetStatus(eReturnStatusFailed);
return false;
}
break;
@@ -249,7 +247,6 @@
if (GetFlags().Test(eCommandProcessMustBePaused)) {
result.AppendError("Process is running. Use 'process interrupt' to "
"pause execution.");
- result.SetStatus(eReturnStatusFailed);
return false;
}
}
@@ -351,7 +348,6 @@
Status error(group_options.NotifyOptionParsingFinished(&exe_ctx));
if (error.Fail()) {
result.AppendError(error.AsCString());
- result.SetStatus(eReturnStatusFailed);
return false;
}
return true;
Index: lldb/source/Commands/CommandObjectWatchpoint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -941,11 +941,11 @@
} else {
const char *error_cstr = error.AsCString(nullptr);
if (error_cstr)
- result.GetErrorStream().Printf("error: %s\n", error_cstr);
+ result.AppendError(error_cstr);
else
- result.GetErrorStream().Printf("error: unable to find any variable "
- "expression path that matches '%s'\n",
- command.GetArgumentAtIndex(0));
+ result.AppendErrorWithFormat("unable to find any variable "
+ "expression path that matches '%s'",
+ command.GetArgumentAtIndex(0));
return false;
}
@@ -1065,10 +1065,8 @@
// If no argument is present, issue an error message. There's no way to
// set a watchpoint.
if (raw_command.trim().empty()) {
- result.GetErrorStream().Printf("error: required argument missing; "
- "specify an expression to evaluate into "
- "the address to watch for\n");
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError("required argument missing; specify an expression "
+ "to evaluate into the address to watch for");
return false;
}
@@ -1095,12 +1093,10 @@
ExpressionResults expr_result =
target->EvaluateExpression(expr, frame, valobj_sp, options);
if (expr_result != eExpressionCompleted) {
- result.GetErrorStream().Printf(
- "error: expression evaluation of address to watch failed\n");
- result.GetErrorStream() << "expression evaluated: \n" << expr << "\n";
+ result.AppendError("expression evaluation of address to watch failed");
+ result.AppendErrorWithFormat("expression evaluated: \n%s", expr.data());
if (valobj_sp && !valobj_sp->GetError().Success())
- result.GetErrorStream() << valobj_sp->GetError().AsCString() << "\n";
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError(valobj_sp->GetError().AsCString());
return false;
}
@@ -1108,9 +1104,7 @@
bool success = false;
addr = valobj_sp->GetValueAsUnsigned(0, &success);
if (!success) {
- result.GetErrorStream().Printf(
- "error: expression did not evaluate to an address\n");
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError("expression did not evaluate to an address");
return false;
}
Index: lldb/source/Commands/CommandObjectVersion.cpp
===================================================================
--- lldb/source/Commands/CommandObjectVersion.cpp
+++ lldb/source/Commands/CommandObjectVersion.cpp
@@ -28,7 +28,6 @@
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
result.AppendError("the version command takes no arguments.");
- result.SetStatus(eReturnStatusFailed);
}
return true;
}
Index: lldb/source/Commands/CommandObjectTarget.cpp
===================================================================
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -318,7 +318,6 @@
if (!target_sp) {
result.AppendError(error.AsCString());
- result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -342,7 +341,6 @@
Status err = platform_sp->PutFile(file_spec, remote_file);
if (err.Fail()) {
result.AppendError(err.AsCString());
- result.SetStatus(eReturnStatusFailed);
return false;
}
}
@@ -357,7 +355,6 @@
Status err = platform_sp->GetFile(remote_file, file_spec);
if (err.Fail()) {
result.AppendError(err.AsCString());
- result.SetStatus(eReturnStatusFailed);
return false;
}
} else {
@@ -851,9 +848,8 @@
}
if (matches == 0) {
- result.GetErrorStream().Printf(
- "error: can't find global variable '%s'\n", arg.c_str());
- result.SetStatus(eReturnStatusFailed);
+ result.AppendErrorWithFormat("can't find global variable '%s'",
+ arg.c_str());
return false;
} else {
for (uint32_t global_idx = 0; global_idx < matches; ++global_idx) {
@@ -2540,7 +2536,6 @@
else
result.AppendErrorWithFormat("unsupported module: %s",
entry.c_str());
- result.SetStatus(eReturnStatusFailed);
return false;
} else {
flush = true;
Index: lldb/source/Commands/CommandObjectReproducer.cpp
===================================================================
--- lldb/source/Commands/CommandObjectReproducer.cpp
+++ lldb/source/Commands/CommandObjectReproducer.cpp
@@ -138,9 +138,7 @@
}
static void SetError(CommandReturnObject &result, Error err) {
- result.GetErrorStream().Printf("error: %s\n",
- toString(std::move(err)).c_str());
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError(toString(std::move(err)));
}
/// Create a loader from the given path if specified. Otherwise use the current
Index: lldb/source/Commands/CommandObjectPlatform.cpp
===================================================================
--- lldb/source/Commands/CommandObjectPlatform.cpp
+++ lldb/source/Commands/CommandObjectPlatform.cpp
@@ -820,10 +820,8 @@
bool DoExecute(Args &args, CommandReturnObject &result) override {
// If the number of arguments is incorrect, issue an error message.
if (args.GetArgumentCount() != 2) {
- result.GetErrorStream().Printf("error: required arguments missing; "
- "specify both the source and destination "
- "file paths\n");
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError("required arguments missing; specify both the "
+ "source and destination file paths");
return false;
}
@@ -894,10 +892,8 @@
bool DoExecute(Args &args, CommandReturnObject &result) override {
// If the number of arguments is incorrect, issue an error message.
if (args.GetArgumentCount() != 1) {
- result.GetErrorStream().Printf("error: required argument missing; "
- "specify the source file path as the only "
- "argument\n");
- result.SetStatus(eReturnStatusFailed);
+ result.AppendError("required argument missing; specify the source file "
+ "path as the only argument");
return false;
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits