From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +62kBnWw7mCrKQAAWB0awg (envelope-from ) for ; Wed, 14 Jul 2021 05:37:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 0BB2A1EDEE; Wed, 14 Jul 2021 05:37:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED 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 00A6E1E4A3 for ; Wed, 14 Jul 2021 05:37:55 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A067038515E3 for ; Wed, 14 Jul 2021 09:37:55 +0000 (GMT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id EA4BB385F02C for ; Wed, 14 Jul 2021 09:37:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA4BB385F02C Authentication-Results: sourceware.org; dmarc=none (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 25DAA226A8 for ; Wed, 14 Jul 2021 09:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626255464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=fD34DV2Blo0xmQW5osnI5v+XvGNz6xSsv9B2SUX/Hu0=; b=Lm0EFmhkcGReNJQpejUKE6VW8Q87H/JWtk3I89UKYltd7TIR+c11/jflZUUi6k3FZFM2eY u9RhLkRgiG/KXMpU50/sd9pAC3bHe+wABlxfV5DlfY1LQvcKXjYGBfAC0nSJR96jyWV0D+ 4i6xjeTVIAp5HYVlm0F7ir4/3Ijiq1M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626255464; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=fD34DV2Blo0xmQW5osnI5v+XvGNz6xSsv9B2SUX/Hu0=; b=hXHSJ8vCt3cfufWHkbJSYw68z1UHUmAkdv1nRrrZEMTurrjYKrjpdTfvEomiq3hsMh7wGh Cx+tnejQbZBimmDg== 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 10BAC13BFA for ; Wed, 14 Jul 2021 09:37:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Q3MEA2iw7mDeIgAAMHmgww (envelope-from ) for ; Wed, 14 Jul 2021 09:37:44 +0000 Date: Wed, 14 Jul 2021 11:37:42 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.base/gold-gdb-index.exp Message-ID: <20210714093740.GA6099@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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" Hi, When running test-case gdb.base/gold-gdb-index.exp on openSUSE Tumbleweed, I run into: ... FAIL: gdb.base/gold-gdb-index.exp: maint info symtabs ... This is due to a dummy .gdb_index: ... Contents of the .gdb_index section: Version 7 CU table: TU table: Address table: Symbol table: ... The dummy .gdb_index is ignored when loading the symbols, and instead partial symbols are used. Consequently, we get the same result as if we'd removed -Wl,--gdb-index from the compilation. Presumably, gold fails to generate a proper .gdb_index because it lacks DWARF5 support. Anyway, without a proper .gdb_index we can't test the gdb behaviour we're trying to excercise. Fix this by detecting whether we actually used a .gdb_index for symbol loading. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.base/gold-gdb-index.exp gdb/testsuite/ChangeLog: 2021-07-14 Tom de Vries * lib/gdb.exp (have_index): New proc. * gdb.base/gold-gdb-index.exp: Use have_index. --- gdb/testsuite/gdb.base/gold-gdb-index.exp | 2 +- gdb/testsuite/lib/gdb.exp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.base/gold-gdb-index.exp index 2a6da322dfd..1af756ac0ec 100644 --- a/gdb/testsuite/gdb.base/gold-gdb-index.exp +++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp @@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \ return -1 } -if { [readnow] } { +if { [have_index $binfile] != "gdb_index" } { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 6b6a70a89b0..04ca56168a1 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7670,6 +7670,34 @@ proc readnow { args } { return $readnow_p } +# Return index name if symbols were read in using an index. +# Otherwise, return "". + +proc have_index { objfile } { + + set res "" + set cmd "maint print objfiles $objfile" + gdb_test_multiple $cmd "" -lbl { + -re "\r\n.gdb_index: faked for \"readnow\"" { + set res "" + exp_continue + } + -re "\r\n.gdb_index:" { + set res "gdb_index" + exp_continue + } + -re "\r\n.debug_names:" { + set res "debug_names" + exp_continue + } + -re -wrap "" { + # We don't care about any other input. + } + } + + return $res +} + # Return 1 if partial symbols are available. Otherwise, return 0. proc psymtabs_p { } {