jasonmolenda updated this revision to Diff 412288.
jasonmolenda added a comment.
Herald added a project: All.
Integrate Jonas' suggestion, update the disassemble shell test to match the new
error messages.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120594/new/
https://reviews.llvm.org/D120594
Files:
lldb/include/lldb/Interpreter/CommandObject.h
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/test/Shell/Commands/command-disassemble.s
Index: lldb/test/Shell/Commands/command-disassemble.s
===================================================================
--- lldb/test/Shell/Commands/command-disassemble.s
+++ lldb/test/Shell/Commands/command-disassemble.s
@@ -6,13 +6,13 @@
# RUN: -s %S/Inputs/command-disassemble.lldbinit -o exit 2>&1 | FileCheck %s
# CHECK: (lldb) disassemble
-# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
+# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame: no currently running process.
# CHECK-NEXT: (lldb) disassemble --line
-# CHECK-NEXT: error: Cannot disassemble around the current line without a selected frame.
+# CHECK-NEXT: error: Cannot disassemble around the current line without a selected frame: no currently running process.
# CHECK-NEXT: (lldb) disassemble --frame
-# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
+# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame: no currently running process.
# CHECK-NEXT: (lldb) disassemble --pc
-# CHECK-NEXT: error: Cannot disassemble around the current PC without a selected frame.
+# CHECK-NEXT: error: Cannot disassemble around the current PC without a selected frame: no currently running process.
# CHECK-NEXT: (lldb) disassemble --start-address 0x0
# CHECK-NEXT: command-disassemble.s.tmp`foo:
# CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>: int $0x10
Index: lldb/source/Commands/CommandObjectDisassemble.cpp
===================================================================
--- lldb/source/Commands/CommandObjectDisassemble.cpp
+++ lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -278,11 +278,20 @@
llvm::Expected<std::vector<AddressRange>>
CommandObjectDisassemble::GetCurrentFunctionRanges() {
+ Process *process = m_exe_ctx.GetProcessPtr();
StackFrame *frame = m_exe_ctx.GetFramePtr();
if (!frame) {
- return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "Cannot disassemble around the current "
- "function without a selected frame.\n");
+ if (process) {
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "function without the process being stopped.\n");
+ } else {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "function without a selected frame: "
+ "no currently running process.\n");
+ }
}
SymbolContext sc(
frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
@@ -301,11 +310,20 @@
llvm::Expected<std::vector<AddressRange>>
CommandObjectDisassemble::GetCurrentLineRanges() {
+ Process *process = m_exe_ctx.GetProcessPtr();
StackFrame *frame = m_exe_ctx.GetFramePtr();
if (!frame) {
- return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "Cannot disassemble around the current "
- "line without a selected frame.\n");
+ if (process) {
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "function without the process being stopped.\n");
+ } else {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "line without a selected frame: "
+ "no currently running process.\n");
+ }
}
LineEntry pc_line_entry(
@@ -361,11 +379,20 @@
llvm::Expected<std::vector<AddressRange>>
CommandObjectDisassemble::GetPCRanges() {
+ Process *process = m_exe_ctx.GetProcessPtr();
StackFrame *frame = m_exe_ctx.GetFramePtr();
if (!frame) {
- return llvm::createStringError(llvm::inconvertibleErrorCode(),
- "Cannot disassemble around the current "
- "PC without a selected frame.\n");
+ if (process) {
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "function without the process being stopped.\n");
+ } else {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Cannot disassemble around the current "
+ "PC without a selected frame: "
+ "no currently running process.\n");
+ }
}
if (m_options.num_instructions == 0) {
Index: lldb/include/lldb/Interpreter/CommandObject.h
===================================================================
--- lldb/include/lldb/Interpreter/CommandObject.h
+++ lldb/include/lldb/Interpreter/CommandObject.h
@@ -326,15 +326,20 @@
}
virtual const char *GetInvalidProcessDescription() {
- return "invalid process";
+ return "Command requires a current process.";
}
- virtual const char *GetInvalidThreadDescription() { return "invalid thread"; }
+ virtual const char *GetInvalidThreadDescription() {
+ return "Command requires a process which is currently stopped.";
+ }
- virtual const char *GetInvalidFrameDescription() { return "invalid frame"; }
+ virtual const char *GetInvalidFrameDescription() {
+ return "Command requires a process, which is currently stopped.";
+ }
virtual const char *GetInvalidRegContextDescription() {
- return "invalid frame, no registers";
+ return "invalid frame, no registers, command requires a process which is "
+ "currently stopped.";
}
// This is for use in the command interpreter, when you either want the
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits