diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/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 diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -278,11 +278,20 @@ llvm::Expected> 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> 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> 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) { diff --git a/lldb/test/Shell/Commands/command-disassemble.s b/lldb/test/Shell/Commands/command-disassemble.s --- a/lldb/test/Shell/Commands/command-disassemble.s +++ b/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