public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait"
@ 2024-03-25 17:40 Andrew Burgess
0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2024-03-25 17:40 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=07505b613a0605ef42a004364ab8ccb70fd3c8eb
commit 07505b613a0605ef42a004364ab8ccb70fd3c8eb
Author: Andrew Burgess <aburgess@redhat.com>
Date: Mon May 9 17:51:54 2022 +0100
Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait"
This reverts commit ac0d67ed1dcf470bad6a3bc4800c2ddc9bedecca.
There was nothing wrong with the commit which I'm reverting here, but
it removed some functionality that will be needed for a later commit;
that is, the ability for GDB to ask for events from a specific ptid_t
via the do_target_wait function.
In a follow up commit, this functionality will be used to implement
inferior function calls in multi-threaded inferiors.
This is not a straight revert of the above commit. Reverting the
above commit replaces a 'nullptr' with 'NULL', I've gone in and
changed that, preserving the 'nullptr'.
Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Tested-By: Luis Machado <luis.machado@arm.com>
Tested-By: Keith Seitz <keiths@redhat.com>
Diff:
---
gdb/infrun.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index bbb98f6dcdb..e0e0ba35a68 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4125,7 +4125,8 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
more events. Polls for events from all inferiors/targets. */
static bool
-do_target_wait (execution_control_state *ecs, target_wait_flags options)
+do_target_wait (ptid_t wait_ptid, execution_control_state *ecs,
+ target_wait_flags options)
{
int num_inferiors = 0;
int random_selector;
@@ -4135,9 +4136,10 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
polling the rest of the inferior list starting from that one in a
circular fashion until the whole list is polled once. */
- auto inferior_matches = [] (inferior *inf)
+ auto inferior_matches = [&wait_ptid] (inferior *inf)
{
- return inf->process_target () != nullptr;
+ return (inf->process_target () != nullptr
+ && ptid_t (inf->pid).matches (wait_ptid));
};
/* First see how many matching inferiors we have. */
@@ -4176,7 +4178,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
auto do_wait = [&] (inferior *inf)
{
- ecs->ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs->ws, options);
+ ecs->ptid = do_target_wait_1 (inf, wait_ptid, &ecs->ws, options);
ecs->target = inf->process_target ();
return (ecs->ws.kind () != TARGET_WAITKIND_IGNORE);
};
@@ -4626,7 +4628,7 @@ fetch_inferior_event ()
the event. */
scoped_disable_commit_resumed disable_commit_resumed ("handling event");
- if (!do_target_wait (&ecs, TARGET_WNOHANG))
+ if (!do_target_wait (minus_one_ptid, &ecs, TARGET_WNOHANG))
{
infrun_debug_printf ("do_target_wait returned no event");
disable_commit_resumed.reset_and_commit ();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-25 17:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 17:40 [binutils-gdb] Revert "gdb: remove unnecessary parameter wait_ptid from do_target_wait" Andrew Burgess
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).