public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target
@ 2023-07-17 19:20 John Baldwin
  2023-07-17 19:20 ` [PATCH v2 1/8] fbsd-nat: Add a list of pending events John Baldwin
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: John Baldwin @ 2023-07-17 19:20 UTC (permalink / raw)
  To: gdb-patches

While this series is not perfect, it does result in a net improvement
in testsuite results on FreeBSD/amd64 and is also a significantly
better experience debugging forking processes.  I'm less confident about
the last two patches but would like to get the first 6 patches into
GDB 14.

Changes since V1:

- A few early trivial patches were merged.

- The list of pending events are now stored as private class members
  of class fbsd_nat_target in Patch 1 along with various style fixes
  noted by Simon.  I also added an assertion that a pending event
  always has an associated inferior when it is added to the list.

- Patch 2 adds a bug trailer.

- Patch 3 is a bit simpler since the methods to work with the pending
  list are now class methods so the "this" pointer doesn't have to be
  passed around as often.  The ptid argument to resume is now renamed
  to scope_ptid.  I also added handling for TARGET_WAITKIND_IGNORE in
  the stop_process helper to avoid adding a bogus pending event if the
  process has disappeared (so wait() fails with ECHILD).  This case
  was caught by the new assertion in Patch 1.

- In patch 4, a workaround in pending_ptrace_events for a kernel bug
  is now conditional since I've merged an upstream fix to FreeBSD's
  kernel since posting the first version at
  https://cgit.freebsd.org/src/commit/?id=653738e895ba022be1179a95a85089e7bc66dbbe

- Patches 5 and 6 are unchanged.

- Patches 7 is new and replaces the ptid_t to identify single LWP vs
  entire process being resumed with an unordered_set<> of resumed LWPs
  permitting multiple individual LWPs in a process to be resumed while
  other LWPs are still suspended.

  Since FreeBSD can only PT_CONTINUE entire processes at a time, this
  means that the resume target method can no longer use ptrace
  directly, but instead stores the requested actions as a set of
  pending actions in the per-inferior data structure.  Later when
  either commit_resumed or wait is called, the target runs through all
  its non-exited inferiors comitting the cumulative results of earlier
  resume calls.

  Because that change is a bit hairy I've kept separate from the
  previous round of multiprocess fixes in patch 3 to make it easier to
  bisect in the future if there are regressions.

- Patch 8 is new and adds an implementation of the stop target method.
  It wasn't clear to me if this is really needed for an all-stop-only
  target, but at least one test in the testsuite was calling this
  method when I made it gdb_assert() instead of being the default.

John Baldwin (8):
  fbsd-nat: Add a list of pending events.
  fbsd-nat: Defer any ineligible events reported by wait.
  fbsd-nat: Fix resuming and waiting with multiple processes.
  fbsd-nat: Fix several issues with detaching.
  fbsd-nat: Fix thread_alive against a running thread.
  fbsd-nat: Stop a process if it is running before killing it.
  fbsd-nat: Defer resume of inferiors.
  fbsd-nat: Implement the target stop method.

 gdb/fbsd-nat.c | 971 ++++++++++++++++++++++++++++++++++++++++++-------
 gdb/fbsd-nat.h |  68 ++++
 2 files changed, 915 insertions(+), 124 deletions(-)

-- 
2.40.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-08-14 17:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 19:20 [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target John Baldwin
2023-07-17 19:20 ` [PATCH v2 1/8] fbsd-nat: Add a list of pending events John Baldwin
2023-07-17 19:20 ` [PATCH v2 2/8] fbsd-nat: Defer any ineligible events reported by wait John Baldwin
2023-07-17 19:20 ` [PATCH v2 3/8] fbsd-nat: Fix resuming and waiting with multiple processes John Baldwin
2023-08-04 16:30   ` Tom Tromey
2023-08-04 21:30     ` John Baldwin
2023-07-17 19:20 ` [PATCH v2 4/8] fbsd-nat: Fix several issues with detaching John Baldwin
2023-07-17 19:20 ` [PATCH v2 5/8] fbsd-nat: Fix thread_alive against a running thread John Baldwin
2023-07-17 19:20 ` [PATCH v2 6/8] fbsd-nat: Stop a process if it is running before killing it John Baldwin
2023-07-17 19:20 ` [PATCH v2 7/8] fbsd-nat: Defer resume of inferiors John Baldwin
2023-07-17 19:20 ` [PATCH v2 8/8] fbsd-nat: Implement the target stop method John Baldwin
2023-08-04 16:45 ` [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target Tom Tromey
2023-08-14 17:51   ` John Baldwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).