[Lldb-commits] [PATCH] D127500: [lldb] [llgs] Make `k` kill all processes, and fix multiple exits

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 10 07:33:49 PDT 2022


mgorny created this revision.
mgorny added reviewers: labath, emaste, krytarowski, jingham.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Modify the behavior of the `k` packet to kill all inferiors rather than
just the current one.  The specification leaves the exact behavior
of this packet up to the implementation but since vKill is specifically
meant to be used to kill a single process, it seems logical to use `k`
to provide the alternate function of killing all of them.

While at it, fix bugs that caused lldb-server to mishandle kills
and exits when more than one process is debugged.  That is:

1. Delay exiting lldb-server until all processes exit, rather than doing that on first exited process.  This requires us to actually remove exited processes from the process list in order to know whether we have any processes left.  The last exited process instance is moved onto a dedicated variable in order to prevent it from being destroyed while the notification is still being handled (i.e. effectively until the next process exits).

2. Fix enabling and disabling stdio forwarding to account for multiple processes running simultaneously.  Now, it is enabled when the first process is resumed, and remains enabled until the last one stops.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D127500

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127500.435912.patch
Type: text/x-patch
Size: 6869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220610/a21a3374/attachment.bin>


More information about the lldb-commits mailing list