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",
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",
___
lldb-commits mailing list
lldb-commit