From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DFA443858C27 for ; Wed, 27 Sep 2023 01:23:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFA443858C27 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1695777794; bh=mZMLkWtL7n9SH5Vx+HSriWm6iU+9kmpKky2hFG/23vk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JODNf3S74QkGgV/vgYTeuE+u9Y2OEKWXWt9qy4uR5qvzf2aIMO84t5Uy94cQLKH9l 4L3Tdd16fxfG2Cet1zP7KFcfyjs6Oq4CAPbxkX+h2V0HyxlIqlCmhHRWiNlbTVuqU+ 7+0KgC/MnfGFag+wkwTOAssen0EgAWZpBeBZ3qoE= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 308631E028; Tue, 26 Sep 2023 21:23:14 -0400 (EDT) Message-ID: <500e0102-f66e-4cd6-b1a8-b147fd2c7836@simark.ca> Date: Tue, 26 Sep 2023 21:23:13 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Read Ada main name from executable, not inferior To: Tom Tromey , Tom Tromey via Gdb-patches Cc: Tom Tromey References: <20230823171120.2566006-1-tromey@adacore.com> <87bkegobsu.fsf@tromey.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <87bkegobsu.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-09-05 11:54, Tom Tromey wrote: >>>>>> "Tom" == Tom Tromey via Gdb-patches writes: > > Tom> An upstream bug report points out this bug: if the user switches from > Tom> one Ada executable to another without "kill"ing the inferior, then the > Tom> "start" command will fail. > > Tom> What happens here is that the Ada "main" name is found in a constant > Tom> string in the executable. But, if the inferior is running, then the > Tom> process_stratum target reads from the inferior memory. > > Tom> This patch fixes the problem by changing the main name code to set > Tom> trust-readonly-sections, causing the target stack to read from the > Tom> executable instead. > > Tom> I looked briefly at changing GNAT to emit DW_AT_main_subprogram > Tom> instead, but this looks to be pretty involved. > > Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25811 > > I'm checking this in. > > Tom Hi Tom, This test fails for me with native-extended-gdbserver: $ make check TESTS="gdb.ada/file-then-restart.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver" FAIL: gdb.ada/file-then-restart.exp: scenario=kill: start second (the program exited) FAIL: gdb.ada/file-then-restart.exp: scenario=no-kill: start second (the program exited) Simon