public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [pushed] gdb: remove unnecessary parameter wait_ptid from do_target_wait
Date: Tue, 22 Jun 2021 14:57:43 -0400	[thread overview]
Message-ID: <20210622185743.2597426-1-simon.marchi@polymtl.ca> (raw)

do_target_wait has a wait_ptid parameter, to filter what ptid we wait
on.  The sole caller of do_target_wait passes minus_one_ptid, meaning
"all ptids".  So in practice, this parameter is not needed, remove it.

gdb/ChangeLog:

	* infrun.c (do_target_wait): Remove wait_ptid parameter.
	(fetch_inferior_event): Adjust.

Change-Id: I54119beb43db678e4b2081dc490f89e7ff878e74
---
 gdb/ChangeLog |  5 +++++
 gdb/infrun.c  | 12 +++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 995c8a1a3756..2bef3a89592f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-22  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* infrun.c (do_target_wait): Remove wait_ptid parameter.
+	(fetch_inferior_event): Adjust.
+
 2021-06-22  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* python/lib/gdb/__init__.py (_execute_unwinders): Return tuple
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 4bd21fde5907..9469b74af397 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3670,8 +3670,7 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
    more events.  Polls for events from all inferiors/targets.  */
 
 static bool
-do_target_wait (ptid_t wait_ptid, execution_control_state *ecs,
-		target_wait_flags options)
+do_target_wait (execution_control_state *ecs, target_wait_flags options)
 {
   int num_inferiors = 0;
   int random_selector;
@@ -3681,10 +3680,9 @@ do_target_wait (ptid_t wait_ptid, execution_control_state *ecs,
      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 = [&wait_ptid] (inferior *inf)
+  auto inferior_matches = [] (inferior *inf)
     {
-      return (inf->process_target () != NULL
-	      && ptid_t (inf->pid).matches (wait_ptid));
+      return inf->process_target () != nullptr;
     };
 
   /* First see how many matching inferiors we have.  */
@@ -3723,7 +3721,7 @@ do_target_wait (ptid_t wait_ptid, execution_control_state *ecs,
 
   auto do_wait = [&] (inferior *inf)
   {
-    ecs->ptid = do_target_wait_1 (inf, wait_ptid, &ecs->ws, options);
+    ecs->ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs->ws, options);
     ecs->target = inf->process_target ();
     return (ecs->ws.kind != TARGET_WAITKIND_IGNORE);
   };
@@ -4080,7 +4078,7 @@ fetch_inferior_event ()
        the event.  */
     scoped_disable_commit_resumed disable_commit_resumed ("handling event");
 
-    if (!do_target_wait (minus_one_ptid, ecs, TARGET_WNOHANG))
+    if (!do_target_wait (ecs, TARGET_WNOHANG))
       {
 	infrun_debug_printf ("do_target_wait returned no event");
 	disable_commit_resumed.reset_and_commit ();
-- 
2.32.0


                 reply	other threads:[~2021-06-22 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210622185743.2597426-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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).