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) {