Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Dominique Quatravaux via Gdb-patches <gdb-patches@sourceware.org>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH] was Re: [PATCH 2/3] [delete] Not-so-harmless spurious call to `wait4`
Date: Thu, 8 Apr 2021 20:25:34 +0000	[thread overview]
Message-ID: <133F84AF-3B74-47B1-BEA2-830151901ADE@epfl.ch> (raw)
In-Reply-To: <f1789e95-ed81-c1f1-862c-710e866d569a@polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]



> Le 8 avr. 2021 à 21:26, Simon Marchi <simon.marchi@polymtl.ca> a écrit :
> 
>   Can you please explain in the commit message what harm
> that wait4 call does and why we want to remove it?


In trying to make a better case in the commit message, I found that swapping the two patches around made more sense. Here is an updated, rebased, single patch (working under the assumption that the other two will be merged first):

From 5c3756e9eb0342b1a5a23bcb54d5b8317743ce0d Mon Sep 17 00:00:00 2001
From: Dominique Quatravaux <dominique.quatravaux@epfl.ch>
Date: Thu, 8 Apr 2021 21:35:57 +0200
Subject: [PATCH] [delete] not-so-harmless spurious call to `wait4`
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 d3edcdf3a74..ac19d330ffb 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1113,9 +1113,6 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
 			      res_pid, status->value.sig);
 		}
 
-	      /* Looks necessary on Leopard and harmless...  */
-	      wait4 (inf->pid, &wstatus, 0, NULL);
-
 	      return ptid_t (inf->pid);
 	    }
 	  else
-- 
2.31.1



— 
  Dominique Quatravaux
  +41 21 69 35624






[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4254 bytes --]

  reply	other threads:[~2021-04-08 20:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 19:14 [PATCH 1/3] [fix] Unused struct Dominique Quatravaux via Gdb-patches
2021-04-08 19:14 ` [PATCH 2/3] [delete] Not-so-harmless spurious call to `wait4` Dominique Quatravaux via Gdb-patches
2021-04-08 19:26   ` Simon Marchi via Gdb-patches
2021-04-08 20:25     ` Dominique Quatravaux via Gdb-patches [this message]
2021-04-09 14:34       ` [PATCH] was " Simon Marchi via Gdb-patches
2021-07-05  2:11         ` Simon Marchi via Gdb-patches
2021-04-08 19:14 ` [PATCH 3/3] [fix] Skip over WIFSTOPPED wait4 status Dominique Quatravaux via Gdb-patches
2021-04-08 19:54   ` Simon Marchi via Gdb-patches
2021-04-08 19:23 ` [PATCH 1/3] [fix] Unused struct Simon Marchi via Gdb-patches
2022-02-16 14:15 ` [RFC][PATCH v2 0/2][PR gdb/24069] Fix GDB hang on macOS 10.14 and later (PR gdb/24609) Philippe Blain via Gdb-patches
2022-02-16 14:15   ` [RFC][PATCH v2 1/2][PR gdb/24069] [delete] Not-so-harmless spurious call to `wait4` Philippe Blain via Gdb-patches
2022-02-19 15:47     ` Simon Marchi via Gdb-patches
2022-02-19 15:57       ` Philippe Blain via Gdb-patches
2022-02-19 16:02         ` Simon Marchi via Gdb-patches
2022-02-16 14:15   ` [RFC][PATCH v2 2/2][PR gdb/24069] [fix] Skip over WIFSTOPPED wait4 status Philippe Blain via Gdb-patches
2022-02-19 15:59     ` Simon Marchi via Gdb-patches
2022-02-19 17:49       ` Philippe Blain via Gdb-patches
2022-02-16 14:23   ` [RFC][PATCH v2 0/2][PR gdb/24069] Fix GDB hang on macOS 10.14 and later (PR gdb/24609) Philippe Blain via Gdb-patches
2022-02-24 14:23   ` [RFC][PATCH v3 0/1][PR gdb/24069] Fix GDB hang on macOS 10.14 and later Philippe Blain via Gdb-patches
2022-02-24 14:23     ` [RFC][PATCH v3 1/1][PR gdb/24069] gdb/darwin: skip over WIFSTOPPED wait4 status Philippe Blain via Gdb-patches
2022-02-24 15:49       ` Simon Marchi via Gdb-patches
2022-02-28 17:52         ` Philippe Blain via Gdb-patches
2022-02-28 18:34           ` Simon Marchi via Gdb-patches
2022-02-28 18:40             ` Philippe Blain via Gdb-patches

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=133F84AF-3B74-47B1-BEA2-830151901ADE@epfl.ch \
    --to=gdb-patches@sourceware.org \
    --cc=dominique.quatravaux@epfl.ch \
    --cc=simon.marchi@polymtl.ca \
    /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