From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 0/8] Fixes for multiprocess for FreeBSD's native target
Date: Mon, 17 Jul 2023 12:20:31 -0700 [thread overview]
Message-ID: <20230717192039.13976-1-jhb@FreeBSD.org> (raw)
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
next reply other threads:[~2023-07-17 19:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 19:20 John Baldwin [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230717192039.13976-1-jhb@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).