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 B4A753858C5F for ; Fri, 10 Feb 2023 10:57:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4A753858C5F 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 F13EF37E01; Fri, 10 Feb 2023 10:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1676026670; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ydwJISfnsh5keAuFKLEKL/OL99XvHH0S29OHoHuP3gs=; b=s/TRIC5TP2wmfV5lRutGh8+3ezSmpiErA2x2ucCmz3ObH7WTKboGvt8/5Jb2Y3R8kLN/Us TYCwMhhL0H599Dlk6mCdwxpnYn2ZSACst+1ltboT/lRBRaR/ZMkz/VoVGmd6qUJu04IjgY T9Zr0TjO8SK0SqRERfqB+85JrKWxeRg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1676026670; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ydwJISfnsh5keAuFKLEKL/OL99XvHH0S29OHoHuP3gs=; b=wTjids9l4XIUgh5BVHTRtI39lp5nm/NO+Xy+xjfz/Y3lSlWvNtusMxBCgy1R2DNbn04GjF +Em9grBXeb5OeWCQ== 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 DA07E1325E; Fri, 10 Feb 2023 10:57:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1QITNC4j5mPzWQAAMHmgww (envelope-from ); Fri, 10 Feb 2023 10:57:50 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Luis Machado Subject: [PATCH] [gdb/testsuite] Fix linespec ambiguity in gdb.base/longjmp.exp Date: Fri, 10 Feb 2023 11:57:49 +0100 Message-Id: <20230210105749.2893-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,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: PR testsuite/30103 reports the following failure on aarch64-linux (ubuntu 22.04): ... (gdb) PASS: gdb.base/longjmp.exp: with_probes=0: pattern 1: next to longjmp next warning: Breakpoint address adjusted from 0x83dc305fef755015 to \ 0xffdc305fef755015. Warning: Cannot insert breakpoint 0. Cannot access memory at address 0xffdc305fef755015 __libc_siglongjmp (env=0xaaaaaaab1018 , val=1) at ./setjmp/longjmp.c:30 30 } (gdb) KFAIL: gdb.base/longjmp.exp: with_probes=0: pattern 1: gdb/26967 \ (PRMS: next over longjmp) delete breakpoints Delete all breakpoints? (y or n) y (gdb) info breakpoints No breakpoints or watchpoints. (gdb) break 63 No line 63 in the current file. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup: breakpoint \ at pattern start (got interactive prompt) ... The test-case intends to set the breakpoint on line number 63 in gdb.base/longjmp.c. It tries to do so by specifying "break 63", which specifies a line in the "current source file". Due to the KFAIL PR, gdb stopped in __libc_siglongjmp, and because of presence of debug info, the "current source file" becomes glibc's ./setjmp/longjmp.c. Consequently, setting the breakpoint fails. Fix this by adding a $subdir/$srcfile: prefix to the breakpoint linespecs. I've managed to reproduce the FAIL on x86_64/-m32, by installing the glibc-32bit-debuginfo package. This allowed me to confirm the "current source file" that is used: ... (gdb) KFAIL: gdb.base/longjmp.exp: with_probes=0: pattern 1: gdb/26967 \ (PRMS: next over longjmp) info source^M Current source file is ../setjmp/longjmp.c^M ... Tested on x86_64-linux, target boards unix/{-m64,-m32}. Reported-By: Luis Machado PR testsuite/30103 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30103 --- gdb/testsuite/gdb.base/longjmp.exp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp index 96d9c1c8059..f74891aa7ca 100644 --- a/gdb/testsuite/gdb.base/longjmp.exp +++ b/gdb/testsuite/gdb.base/longjmp.exp @@ -82,6 +82,9 @@ proc do_test { with_probes } { gdb_assert { !$have_longjmp_probe } } + # When using these line numbers in break linespecs, prefix each of these + # with "$subdir/$srcfile:" to avoid referring to a glibc file when stopped + # in __libc_siglongjmp or similar. set bp_miss_step_1 [gdb_get_line_number "miss_step_1"] set bp_miss_step_2 [gdb_get_line_number "miss_step_2"] @@ -104,13 +107,13 @@ proc do_test { with_probes } { with_test_prefix setup { delete_breakpoints - gdb_test "break $bp_start_test_1" \ + gdb_test "break $::subdir/$::srcfile:$bp_start_test_1" \ "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_1.*" \ "breakpoint at pattern start" gdb_test "continue" "patt1.*" "continue to breakpoint at pattern start" # set safe-net break - gdb_test "break $bp_miss_step_1" \ + gdb_test "break $::subdir/$::srcfile:$bp_miss_step_1" \ "Breakpoint.*at.* file .*$::srcfile, line.*$bp_miss_step_1.*" \ "breakpoint at safety net" } @@ -151,13 +154,13 @@ proc do_test { with_probes } { with_test_prefix setup { delete_breakpoints - gdb_test "break $bp_start_test_2" \ + gdb_test "break $::subdir/$::srcfile:$bp_start_test_2" \ "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_2.*" \ "breakpoint at pattern start" gdb_test "continue" "patt2.*" "continue to breakpoint at pattern start" # set safe-net break - gdb_test "break $bp_miss_step_2" \ + gdb_test "break $::subdir/$::srcfile:$bp_miss_step_2" \ "Breakpoint.*at.* file .*$::srcfile, line.*$bp_miss_step_2.*" \ "breakpoint at safety net" } @@ -198,7 +201,7 @@ proc do_test { with_probes } { with_test_prefix setup { delete_breakpoints - gdb_test "break $bp_start_test_3" \ + gdb_test "break $::subdir/$::srcfile:$bp_start_test_3" \ "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_3.*" \ "breakpoint at pattern start" gdb_test "continue" "patt3.*" "continue to breakpoint at pattern start" base-commit: fe8cdc8ec145a166414fc375cf2cb65d9a8085a1 -- 2.35.3