From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v5 05/15] Don't enable async mode at the end of target ::resume methods.
Date: Fri, 21 Jan 2022 12:16:21 -0800 [thread overview]
Message-ID: <20220121201631.63530-6-jhb@FreeBSD.org> (raw)
In-Reply-To: <20220121201631.63530-1-jhb@FreeBSD.org>
Now that target_resume always enables async mode after target::resume
returns, these calls are redundant.
The other place that target resume methods are invoked outside of
target_resume are as the beneath target in record_full_wait_1. In
this case, async mode should already be enabled when supported by the
target before the resume method is invoked due to the following:
In general, targets which support async mode run as async until
::wait returns TARGET_WAITKIND_NO_RESUMED to indicate that there are
no unwaited for children (either they have exited or are stopped).
When that occurs, the loop in wait_one disables async mode. Later
if a stopped child is resumed, async mode is re-enabled in
do_target_resume before waiting for the next event.
In the case of record_full_wait_1, this function is invoked from the
::wait target method when fetching an event. If the underlying
target supports async mode, then an earlier call to do_target_resume
to resume the child reporting an event in the loop in
record_full_wait_1 would have already enabled async mode before
::wait was invoked. In addition, nothing in the code executed in
the loop in record_full_wait_1 disables async mode. Async mode is
only disabled higher in the call stack in wait_one after ::wait
returns.
It is also true that async mode can be disabled by an
INF_EXEC_COMPLETE event passed to inferior_event_handle, but all of
the places that invoke that are in the gdb core which is "above" a
target ::wait method.
Note that there is an earlier call to enable async mode in
linux_nat_target::resume. That call also marks the async event pipe
to report an existing event after enabling async mode, so it needs to
stay.
---
gdb/linux-nat.c | 3 ---
gdb/record-full.c | 10 ----------
gdb/remote.c | 10 ----------
3 files changed, 23 deletions(-)
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index db3585dfa23..621118ba862 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1764,9 +1764,6 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
? strsignal (gdb_signal_to_host (signo)) : "0"));
linux_resume_one_lwp (lp, step, signo);
-
- if (target_can_async_p ())
- target_async (1);
}
/* Send a signal to an LWP. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 76b21523853..bd8c49c1abe 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1095,11 +1095,6 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
this->beneath ()->resume (ptid, step, signal);
}
-
- /* We are about to start executing the inferior (or simulate it),
- let's register it with the event loop. */
- if (target_can_async_p ())
- target_async (1);
}
static int record_full_get_sig = 0;
@@ -2062,11 +2057,6 @@ record_full_core_target::resume (ptid_t ptid, int step,
record_full_resume_step = step;
record_full_resumed = 1;
record_full_execution_dir = ::execution_direction;
-
- /* We are about to start executing the inferior (or simulate it),
- let's register it with the event loop. */
- if (target_can_async_p ())
- target_async (1);
}
/* "kill" method for prec over corefile. */
diff --git a/gdb/remote.c b/gdb/remote.c
index b093ad86675..2711e5a301c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -6571,16 +6571,6 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
for (thread_info *tp : all_non_exited_threads (this, ptid))
get_remote_thread_info (tp)->set_resumed ();
- /* We are about to start executing the inferior, let's register it
- with the event loop. NOTE: this is the one place where all the
- execution commands end up. We could alternatively do this in each
- of the execution commands in infcmd.c. */
- /* FIXME: ezannoni 1999-09-28: We may need to move this out of here
- into infcmd.c in order to allow inferior function calls to work
- NOT asynchronously. */
- if (target_can_async_p ())
- target_async (1);
-
/* We've just told the target to resume. The remote server will
wait for the inferior to stop, and then send a stop reply. In
the mean time, we can't start another command/query ourselves
--
2.34.1
next prev parent reply other threads:[~2022-01-21 20:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 20:16 [PATCH v5 00/15] FreeBSD target async mode and related refactoring John Baldwin
2022-01-21 20:16 ` [PATCH v5 01/15] gdbsupport: Add an event-pipe class John Baldwin
2022-01-21 20:16 ` [PATCH v5 02/15] gdb linux-nat: Convert linux_nat_event_pipe to the event_pipe class John Baldwin
2022-01-21 20:16 ` [PATCH v5 03/15] gdbserver linux-low: Convert linux_event_pipe " John Baldwin
2022-01-21 20:16 ` [PATCH v5 04/15] Enable async mode on supported targets in target_resume John Baldwin
2022-02-20 10:47 ` Joel Brobecker
2022-01-21 20:16 ` John Baldwin [this message]
2022-02-20 10:49 ` [PATCH v5 05/15] Don't enable async mode at the end of target ::resume methods Joel Brobecker
2022-01-21 20:16 ` [PATCH v5 06/15] do_target_wait_1: Clear TARGET_WNOHANG if the target isn't async John Baldwin
2022-02-22 22:38 ` Simon Marchi
2022-02-23 0:07 ` John Baldwin
2022-02-23 1:40 ` Simon Marchi
2022-02-23 15:51 ` Simon Marchi
2022-02-23 16:12 ` John Baldwin
2022-02-24 2:46 ` Simon Marchi
2022-02-24 19:02 ` John Baldwin
2022-02-24 19:16 ` Simon Marchi
2022-01-21 20:16 ` [PATCH v5 07/15] inf-ptrace: Return an IGNORE event if waitpid() fails John Baldwin
2022-02-20 11:38 ` Joel Brobecker
2022-01-21 20:16 ` [PATCH v5 08/15] inf-ptrace: Support async targets in inf_ptrace_target::wait John Baldwin
2022-01-21 20:16 ` [PATCH v5 09/15] fbsd-nat: Implement async target support John Baldwin
2022-01-21 20:16 ` [PATCH v5 10/15] fbsd-nat: Include ptrace operation in error messages John Baldwin
2022-01-21 20:16 ` [PATCH v5 11/15] fbsd-nat: Various cleanups to the ::resume entry debug message John Baldwin
2022-01-21 20:16 ` [PATCH v5 12/15] fbsd-nat: Return nullptr rather than failing ::thread_name John Baldwin
2022-01-21 20:16 ` [PATCH v5 13/15] Enable async mode in the target in attach_cmd John Baldwin
2022-01-21 20:16 ` [PATCH v5 14/15] inf-ptrace: Add an event_pipe to be used for async mode in subclasses John Baldwin
2022-01-21 20:16 ` [PATCH v5 15/15] NEWS: Note that the FreeBSD async target supports async mode John Baldwin
2022-01-22 6:28 ` Eli Zaretskii
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=20220121201631.63530-6-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).