From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 151533858417 for ; Wed, 26 Jul 2023 11:48:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 151533858417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 26F9421D9A; Wed, 26 Jul 2023 11:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690372080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nRGO1Pb7mO+/rXsNR3eu4VGO4srGRpnafV7U5OUECTE=; b=1eiz+CGBdBjWRTWPSYxsWiciP7R7uKOtRukv+o3TWiT//xuny+ArFGXyxd24ms3JSCjwmv fobvk1Ugo6LjCdaZTtJQeSzhTGfssUnDcjhbvfBN15bA0kdVSqJzsJtXzuqvItmA0+TQBi 9UZzadqtPl7tXIiq5MjC4MdEaIBvL4Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690372080; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nRGO1Pb7mO+/rXsNR3eu4VGO4srGRpnafV7U5OUECTE=; b=ZBdhLgav0ijHAf/cZTXqP8BwMqwsNB7wyhk35AwZWHLP4CdcZuRx7cuRNogpGJWh2zwAwB QmzBnkO1pxC7JyAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0D5BE1341F; Wed, 26 Jul 2023 11:48:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wXMiAvAHwWTILwAAMHmgww (envelope-from ); Wed, 26 Jul 2023 11:48:00 +0000 Message-ID: <001f58cd-3479-0a51-7148-974d531bfc27@suse.de> Date: Wed, 26 Jul 2023 13:47:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] [gdb/testsuite] Drop -nostdlib in gdb.dwarf2/typeddwarf.exp Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org Cc: Tom Tromey References: <20230713141524.31882-1-tdevries@suse.de> From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,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/24/23 18:21, Simon Marchi wrote: > 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 for testing, committed. - Tom