[Lldb-commits] [PATCH] D32366: Set "success" status correctly
John Lindal via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 28 11:18:24 PDT 2017
jafl updated this revision to Diff 112922.
jafl added a comment.
Added lldbassert
https://reviews.llvm.org/D32366
Files:
source/Commands/CommandObjectRegister.cpp
source/Interpreter/CommandInterpreter.cpp
Index: source/Interpreter/CommandInterpreter.cpp
===================================================================
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -68,6 +68,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/LLDBAssert.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
@@ -1675,6 +1676,7 @@
remainder.c_str());
cmd_obj->Execute(remainder.c_str(), result);
+ lldbassert(eReturnStatusStarted != result.GetStatus());
} else {
// We didn't find the first command object, so complete the first argument.
Args command_args(command_string);
Index: source/Commands/CommandObjectRegister.cpp
===================================================================
--- source/Commands/CommandObjectRegister.cpp
+++ source/Commands/CommandObjectRegister.cpp
@@ -171,7 +171,9 @@
set_idx = m_command_options.set_indexes[i]->GetUInt64Value(UINT32_MAX,
nullptr);
if (set_idx < reg_ctx->GetRegisterSetCount()) {
- if (!DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) {
+ if (DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) {
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ } else {
if (errno)
result.AppendErrorWithFormatv("register read failed: {0}\n",
llvm::sys::StrError());
@@ -196,6 +198,7 @@
// registers.
DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx,
!m_command_options.dump_all_sets.GetCurrentValue());
+ result.SetStatus(eReturnStatusSuccessFinishResult);
}
}
} else {
@@ -220,7 +223,9 @@
reg_info = reg_ctx->GetRegisterInfoByName(arg_str);
if (reg_info) {
- if (!DumpRegister(m_exe_ctx, strm, reg_ctx, reg_info))
+ if (DumpRegister(m_exe_ctx, strm, reg_ctx, reg_info))
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ else
strm.Printf("%-12s = error: unavailable\n", reg_info->name);
} else {
result.AppendErrorWithFormat("Invalid register name '%s'.\n",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32366.112922.patch
Type: text/x-patch
Size: 2348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170828/6cdd3d80/attachment.bin>
More information about the lldb-commits
mailing list