From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SI25ET8HDWIsNwAAWB0awg (envelope-from ) for ; Wed, 16 Feb 2022 09:16:31 -0500 Received: by simark.ca (Postfix, from userid 112) id 2CB2D1F3C9; Wed, 16 Feb 2022 09:16:31 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C17CC1EDF0 for ; Wed, 16 Feb 2022 09:16:30 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2AD113857C6E for ; Wed, 16 Feb 2022 14:16:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AD113857C6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1645020990; bh=OkkeRnRkp/JII8GceNUVMz54tBb6swa5YIFLI5xt80g=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vgDERsir9FM8WgB0jH/ac0J/gHoMH/E37cbFNGLnCpS5zKSLNSKPS0UgnoGT4b0YU gH6b1muFZ/JRxP+b0Ohn6IVvs9l18IzsQx0C2bEHIHrx3/ZMS8hVxyzdJ6/HAE9xkh kMWmcm+wjeePeHOMEZHP/1gfV0/rtmpuNp6uaLI4= Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by sourceware.org (Postfix) with ESMTPS id 728B93858C2C for ; Wed, 16 Feb 2022 14:15:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 728B93858C2C Received: by mail-qt1-x82c.google.com with SMTP id q20so2137971qtw.8 for ; Wed, 16 Feb 2022 06:15:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OkkeRnRkp/JII8GceNUVMz54tBb6swa5YIFLI5xt80g=; b=6Z/3vefjisW6jlOqsCmQr3Hgs1oSEvFLQAAtQp5pFQS9vUFY/udGcTZ1qsrjlNi8Ak 5gwXsIFyvFitXeZyiaz+Zzsd2BNJnjcGxhJLBM1Wg++dVq8ULGwZOq/fT4DY51Q9eGfS 2YJB4dz7wUHfrhjDN+3YJP/yjLC2pYaAkx7pRfGc8jjN5c9U8MN2fDCyOfpSizF6S4x+ IFk5uSNstWqRzCRb3hX8qExJ7nmbN3nY6/ohsUCdcqrW25ngYxwWr4FRPPh+Xe9s2ysy ErbO4RnyCK9BsfFKa3DAdOPttEoX+3tdBWR9lD84D6Fj8EMRZLqrgIcXJ+2hddQhG/Sc op0A== X-Gm-Message-State: AOAM533hFo03MUHBy6QMTk5p2lzsUWbycYo4PbquB+sHKeTp/x8d3RpW 4LwJyiOTfKTBep5azBwo/rhVyb2XBVQrRg== X-Google-Smtp-Source: ABdhPJzVzfxIeg3WfHhl68AT682urTFTZBiv9IROdC3p9i1N31U4RAnxgze6zzeYXe5vAwYH+yBlIQ== X-Received: by 2002:a05:622a:18b:b0:2dc:ab83:8108 with SMTP id s11-20020a05622a018b00b002dcab838108mr2103387qtw.432.1645020943763; Wed, 16 Feb 2022 06:15:43 -0800 (PST) Received: from localhost.localdomain (173-246-5-136.qc.cable.ebox.net. [173.246.5.136]) by smtp.gmail.com with ESMTPSA id w4sm19653239qko.123.2022.02.16.06.15.42 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 Feb 2022 06:15:43 -0800 (PST) To: gdb-patches@sourceware.org Subject: [RFC][PATCH v2 1/2][PR gdb/24069] [delete] Not-so-harmless spurious call to `wait4` Date: Wed, 16 Feb 2022 09:15:39 -0500 Message-Id: <20220216141540.96514-2-levraiphilippeblain@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220216141540.96514-1-levraiphilippeblain@gmail.com> References: <20210408191449.27434-1-dominique.quatravaux@epfl.ch> <20220216141540.96514-1-levraiphilippeblain@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Philippe Blain via Gdb-patches Reply-To: Philippe Blain Cc: Louis-He <1726110778@qq.com>, Dominique Quatravaux , Sam Warner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" From: Dominique Quatravaux 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. ChangeLog: 2022-02-05 Dominique Quatravaux PR gdb/24609 * gdb/darwin-nat.c (darwin_nat_target::decode_message): Remove spurious call to wait4. --- gdb/darwin-nat.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index d96ce1a6c65..8b0ecfd5b77 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, 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.29.2