aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectWatchpoint.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2021-06-21 15:10:46 +0000
committerDavid Spickett <david.spickett@linaro.org>2021-06-22 15:28:28 +0000
commita8dd7094d364f6fb4921627a36b920e5098e88c3 (patch)
tree729d41dcf57c3d43d723ca8a6ac1376aff19b1fd /lldb/source/Commands/CommandObjectWatchpoint.cpp
parent873ff5a72864fdf60614cca8adbd0d869fc9a9a2 (diff)
downloadllvm-a8dd7094d364f6fb4921627a36b920e5098e88c3.zip
llvm-a8dd7094d364f6fb4921627a36b920e5098e88c3.tar.gz
llvm-a8dd7094d364f6fb4921627a36b920e5098e88c3.tar.bz2
[lldb] Remove more redundant SetStatus(eReturnStatusFailed)
Mostly by converting uses of GetErrorStream to AppendError, so that the call to SetStatus is implicit. Some remain where it isn't certain that you'll have a message to set, or you want the output to be on stdout. One place in CommandObjectWatchpoint previously didn't set the status to failed at all. However it's pretty obvious that it should do so. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D104697
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index a426b38..d7a446f 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -941,11 +941,11 @@ protected:
} 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 @@ protected:
// 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 @@ protected:
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 @@ protected:
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;
}