Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sam Warner via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] Pick up Dominique Quatravaux 2cnd macOS modifications gdb
Date: Fri, 9 Jul 2021 09:26:26 -0700	[thread overview]
Message-ID: <1E9C17B9-0F4B-42B9-B21C-C23FA8D9B4BE@me.com> (raw)

From 92c389951e87ad12652d330b08f8d3a929c5ae5d Mon Sep 17 00:00:00 2001
From: Sam Warner <samuuel.r.warner@me.com>
Date: Thu, 8 Jul 2021 19:17:14 -0700
Subject: [PATCH] Pick up Dominique Quatravaux 2cnd macOS modifications gdb
 10.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As seen in https://sourceware.org/bugzilla/show_bug.cgi?id=24069 this
code will typically wait4() a second time on the same process that was
already wait4()'d a few lines above. While this used to be
harmless/idempotent (when we assumed that the process already exited),
this now causes a deadlock in the WIFSTOPPED case.

The early (~2019) history of bug #24069 cautiously suggests to use
WNOHANG instead of outright deleting the call. However, tests on the
current version of Darwin (Big Sur) demonstrate that gdb runs just
fine without a redundant call to wait4(), as would be expected.
Notwithstanding the debatable value of conserving bug compatibility
with an OS release that is more than a decade old, there is scant
evidence of what that double-wait4() was supposed to achieve in the
first place - A cursory investigation with `git blame` pinpoints
commits bb00b29d7802 and a80b95ba67e2 from the 2008-2009 era, but
fails to answer the “why” question conclusively.
---
 gdb/darwin-nat.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index a6790792fb6..413e70811c4 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1106,9 +1106,6 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
 	      inferior_debug (4, _("darwin_wait: pid=%d exit, status=0x%x\n"),
 			      res_pid, wstatus);
 
-	      /* Looks necessary on Leopard and harmless...  */
-	      wait4 (inf->pid, &wstatus, 0, NULL);
-
 	      return ptid_t (inf->pid);
 	    }
 	  else
-- 
2.32.0


                 reply	other threads:[~2021-07-09 16:26 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=1E9C17B9-0F4B-42B9-B21C-C23FA8D9B4BE@me.com \
    --to=gdb-patches@sourceware.org \
    --cc=samuel.r.warner@me.com \
    /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