From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id C5F02385701F for ; Tue, 23 Mar 2021 13:50:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5F02385701F Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 12NDoQ5H027028 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Mar 2021 09:50:30 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 12NDoQ5H027028 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 BB2721E54D; Tue, 23 Mar 2021 09:50:25 -0400 (EDT) Subject: Re: [PATCH 2/3] gdb: remove push_target free functions To: "Aktemur, Tankut Baris" Cc: "gdb-patches@sourceware.org" References: <20210322032027.3397705-1-simon.marchi@polymtl.ca> <20210322032027.3397705-2-simon.marchi@polymtl.ca> <8c904425-6606-d227-ab67-876ee74211ee@polymtl.ca> <6cb24e96-b8b7-6828-6673-cc06f04a0796@polymtl.ca> From: Simon Marchi Message-ID: <54395c9b-a1fb-174c-6e2d-359f43718b6c@polymtl.ca> Date: Tue, 23 Mar 2021 09:50:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <6cb24e96-b8b7-6828-6673-cc06f04a0796@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 23 Mar 2021 13:50:26 +0000 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 23 Mar 2021 13:50:35 -0000 On 2021-03-22 2:21 p.m., Simon Marchi via Gdb-patches wrote: > On 2021-03-22 1:31 p.m., Simon Marchi via Gdb-patches wrote: >>>> index bcc54bd966fe..b737bcf6e0f3 100644 >>>> --- a/gdb/exec.c >>>> +++ b/gdb/exec.c >>>> @@ -616,7 +616,7 @@ program_space::add_target_sections (void *owner, >>>> continue; >>>> >>>> switch_to_inferior_no_thread (inf); >>>> - push_target (&exec_ops); >>>> + inf->push_target (&exec_ops); >>> >>> Similar to the previous patch, it should be OK to also remove the >>> switch_to_inferior_no_thread here. >> >> Similarly, pushing a target can cause another (at the same stratum) to >> get unpushed, and some target_ops::close implementations refer to the >> current inferior. So out of caution I would leave it. I'll also add >> a note to the commit message here. > > Here too, it should be safe to remove it, now that I think about it. > We check just before that the exec target isn't pushed on the inferior's > stack, and there isn't any other file_stratum that could be there. So > I'll remove it. Thanks for making me double check that. Ok, I tried to do this and failed. Removing the inferior switching uncovers what I think is a latent bug somewhere in the follow-fork mechanism. The follow_fork_inferior function leaves things in an invalid state, where the current inferior/thread/program space don't match. That switch_to_inferior_no_thread call (or rather the restore) happens to make things right, by chance. So what I'll do is push the original versions of the patches, and investigate this issue independently. Simon