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 67A893858C5E for ; Mon, 24 Jul 2023 16:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67A893858C5E 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=1690215680; bh=9hFi3KA0SkqXkNXpr0nfv0/J6wfjQsP+uaCHxdu2BNg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=tnGxTVvO6ihcBoYUvXTaxSiRN1mP+ZCIKz5FqOoW4iNkOKRm4fCWq3GGn6z/S3v6A rXaK2GPz1TQ5MHJTFVlJ8KFbPqoc9dwflAjqnPOJIO2JnRk6E/Gx2qBH6EJc7sDelb VTcLT2N9bcEOt0EgvwbjhKNyOH5jrwdnIjb2Uv+0= Received: from [10.0.0.170] (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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 5FCD71E00F; Mon, 24 Jul 2023 12:21:20 -0400 (EDT) Message-ID: Date: Mon, 24 Jul 2023 12:21:19 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] [gdb/testsuite] Drop -nostdlib in gdb.dwarf2/typeddwarf.exp To: Tom de Vries , gdb-patches@sourceware.org Cc: Tom Tromey References: <20230713141524.31882-1-tdevries@suse.de> Content-Language: fr From: Simon Marchi In-Reply-To: <20230713141524.31882-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 7/13/23 10:15, Tom de Vries via Gdb-patches wrote: > As reported in PR testsuite/30633, when running test-case > gdb.dwarf2/typeddwarf.exp with target board native-gdbserver on Ubuntu > 22.04.2, we run into: > ... > (gdb) continue^M > Continuing.^M > ^M > Program received signal SIGSEGV, Segmentation fault.^M > 0x0000000000000001 in ?? ()^M > (gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main > ... > > We run into the FAIL as follows: > - due to using gdbserver, we attach at the point of the first instruction, in > _start > - we then set a breakpoint at main > - the test-case is a .s file, that has main renamed to _start in the assembly, > but not in the debuginfo > - setting a breakpoint at main sets the breakpoint at the same instruction > we're currently stopped at > - continue doesn't hit the breakpoint, and we return out of _start, which > causes a sigsegv > > Note that this is for the amd64 case (using gdb.dwarf2/typeddwarf-amd64.S). > For the i386 case (using gdb.dwarf2/typeddwarf.S), setting a breakpoint in > main sets it one insn after function entry, and consequently the problem does > not occur. > > The FAIL is a regression since commit 90cce6c0551 ("[gdb/testsuite] Add nopie > in a few test-cases"). > > Without nopie the executable is PIE, with nopie it's static instead. > > In the PIE case, we attach at the point of _start in the dynamic linker, and > consequently we do not skip the breakpoint in main, and also don't run into > the FAIL. > > Fix this by: > - removing the -nostdlib setting, and > - renaming _start to main in both .S files. > > The change to use -nostdlib and rename main to _start was originally added > in commit 6edba76fe8b (submitted here: > https://sourceware.org/pipermail/gdb-patches/2011-May/082657.html ) , I assume > to fix the problem now fixed by using nopie. > > Tested on x86_64-linux. > > Reported-By: Simon Marchi > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30633 I have not dug in the code at all, but I confirm that the patch fixes the test. Therefore: Tested-By: Simon Marchi Thanks, Simon