From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cMExATNmJmJVFQAAWB0awg (envelope-from ) for ; Mon, 07 Mar 2022 15:08:19 -0500 Received: by simark.ca (Postfix, from userid 112) id 02DBF1F3CA; Mon, 7 Mar 2022 15:08:19 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 9738D1EA69 for ; Mon, 7 Mar 2022 15:08:18 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BBA18385783E for ; Mon, 7 Mar 2022 20:08:17 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 29912385841D for ; Mon, 7 Mar 2022 20:08:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29912385841D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 815031EA69; Mon, 7 Mar 2022 15:08:06 -0500 (EST) Message-ID: Date: Mon, 7 Mar 2022 15:08:05 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 07/11] Re-add zombie leader on exit, gdb/linux Content-Language: tl To: Pedro Alves , gdb-patches@sourceware.org References: <20220303144020.3601082-1-pedro@palves.net> <20220303144020.3601082-8-pedro@palves.net> From: Simon Marchi In-Reply-To: <20220303144020.3601082-8-pedro@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-03-03 09:40, Pedro Alves wrote: > @@ -2814,7 +2822,23 @@ linux_nat_filter_event (int lwpid, int status) > /* Don't report an event for the exit of an LWP not in our > list, i.e. not part of any inferior we're debugging. > This can happen if we detach from a program we originally > - forked and then it exits. */ > + forked and then it exits. However, note that we may have > + earlier deleted a leader of an inferior we're debugging, > + in check_zombie_leaders. Re-add it back here if so. */ > + for (inferior *inf : all_inferiors (linux_target)) > + { > + if (inf->pid == lwpid) > + { > + linux_nat_debug_printf > + ("Re-adding thread group leader LWP %d after exit.", > + lwpid); > + > + lp = add_lwp (ptid_t (lwpid, lwpid)); > + lp->resumed = 1; > + add_thread (linux_target, lp->ptid); > + break; > + } > + } Should we do this only if WIFEXITED? We don't expect to get any other event from a deleted leader, so it's more to be safe in case there is a kernel bug or something that would make us see something else. Otherwise, LGTM. Simon