[Lldb-commits] [PATCH] D120594: Improve error messages for command that need a stopped process

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 25 15:40:07 PST 2022


jasonmolenda created this revision.
jasonmolenda added a reviewer: jingham.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

I don't think lldb's error messaging is great when attached to a process -- the command interpreter's commands are asynchronous -- and the user doesn't realize that it is currently executing.  They resume execution and they can type more commands while the inferior process is executing.  This leads to people getting messages like

(lldb) c
Process 82784 resuming
(lldb) si
error: invalid thread
(lldb) dis
error: Cannot disassemble around the current function without a selected frame.

(lldb) reg read pc
error: invalid thread
(lldb) p/x $pc
error: Process is running.  Use 'process interrupt' to pause execution.
(lldb)

That last one was good, but the rest are mystifying unless you work on lldb and know how the command requirements are expressed/tested.

This patch changes the error messages, and for the disassembler, adds cases where we have a Process and where we don't (in a way that is messy but all 3 instances print slightly different error messages).

There may be suggestions or other ideas for how these could be phrased.  I avoided the term "live process" because I was thinking of corefile debugging, but "stopped process" may make people think "well I killed the process, it's stopped now, why can't I disassemble" lol.  I'm trying to think less like an lldb programmer and more like an lldb user, and I think these terms get the point across:

(lldb) c
Process 82784 resuming
(lldb) si
error: Command requires a process which is currently stopped.
(lldb) dis
error: Cannot disassemble around the current function without the process being stopped.
(lldb) reg read pc
error: Command requires a process which is currently stopped.
(lldb)

lldb/test/Shell/Commands/command-disassemble.s will need to be updated with the final messaging too, before this could be landed.  But I suspect there may be some suggestions for edits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120594

Files:
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/Commands/CommandObjectDisassemble.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120594.411534.patch
Type: text/x-patch
Size: 4487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220225/f0698af5/attachment.bin>


More information about the lldb-commits mailing list