From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 1HWaA+ru9GKr8iQAWB0awg (envelope-from ) for ; Thu, 11 Aug 2022 07:58:34 -0400 Received: by simark.ca (Postfix, from userid 112) id 072E01E5EA; Thu, 11 Aug 2022 07:58:34 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NZVcezCz; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 8C2301E21F for ; Thu, 11 Aug 2022 07:58:33 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3CD5C385AC20 for ; Thu, 11 Aug 2022 11:58:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CD5C385AC20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1660219113; bh=eFF3Jy+t+QnwMqyYav7A6b46z2tip1lmgti456wo+3c=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=NZVcezCzSUblV/KbPY+n7h7IAzQriSJmXS7VkMuOc1524XtUGTl7KEC8Y4RvKQQys LJ3jwCaiSd4kRE0GMzJcfCDmrZA5EC+4oOQasWdENYGr28e2FTB8gVPHMp5e/GhzZE aYQ2BqdnxhJ3bYAs768g90MX26vQ9x4ksnubP/DE= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E89BA3858429 for ; Thu, 11 Aug 2022 11:58:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E89BA3858429 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-out2.suse.de (Postfix) with ESMTPS id 26D855CC6C; Thu, 11 Aug 2022 11:58:13 +0000 (UTC) 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 0DD151342A; Thu, 11 Aug 2022 11:58:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id tPU0AtXu9GK9OAAAMHmgww (envelope-from ); Thu, 11 Aug 2022 11:58:13 +0000 Date: Thu, 11 Aug 2022 13:58:11 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp Message-ID: <20220811115809.GA19509@delia> 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.dwarf2/dw2-dir-file-name.exp on x86_64-linux, we have: ... (gdb) break compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x4004c4: file tmp-dw2-dir-file-name.c, line 999.^M (gdb) continue^M Continuing.^M ^M Breakpoint 2, 0x00000000004004c4 in \ compdir_missing__ldir_missing__file_basename () \ at tmp-dw2-dir-file-name.c:999^M (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \ compdir_missing__ldir_missing__file_basename: continue to breakpoint: \ compdir_missing__ldir_missing__file_basename ... When trying to set a breakpoint on compdir_missing__ldir_missing__file_basename, the architecture-specific prologue skipper starts at 0x4004c0 and skips past two insns, to 0x4004c4: ... 00000000004004c0 : 4004c0: 55 push %rbp 4004c1: 48 89 e5 mov %rsp,%rbp 4004c4: 8b 05 72 1b 20 00 mov 0x201b72(%rip),%eax # 60203c 4004ca: 83 c0 01 add $0x1,%eax 4004cd: 89 05 69 1b 20 00 mov %eax,0x201b69(%rip) # 60203c 4004d3: 90 nop 4004d4: 5d pop %rbp 4004d5: c3 ret ... And because the line table info is rudamentary: ... CU: tmp-dw2-dir-file-name.c: File name Line number Starting address View Stmt tmp-dw2-dir-file-name.c 999 0x4004c0 x tmp-dw2-dir-file-name.c 1000 0x4004d6 x tmp-dw2-dir-file-name.c - 0x4004d6 ... the address does not fall at an actual line, so the breakpoint is shown with address, both when setting it and hitting it. when running the test-case with aarch64-linux, we have similarly: ... (gdb) break compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x400618: file tmp-dw2-dir-file-name.c, line 999.^M ... due to the architecture-specific prologue skipper starting at 0x400610 and skipping past two insns, to 0x400618: ... 0000000000400610 : 400610: 90000100 adrp x0, 420000 <__libc_start_main@GLIBC_2.17> 400614: 9100b000 add x0, x0, #0x2c 400618: b9400000 ldr w0, [x0] 40061c: 11000401 add w1, w0, #0x1 400620: 90000100 adrp x0, 420000 <__libc_start_main@GLIBC_2.17> 400624: 9100b000 add x0, x0, #0x2c 400628: b9000001 str w1, [x0] 40062c: d503201f nop 400630: d65f03c0 ret ... But interestingly, the aarch64 architecture-specific prologue skipper is wrong. There is no prologue, and the breakpoint should be set at 0x400610. By using "break *compdir_missing__ldir_missing__file_basename" we can get the breakpoint set at 0x400610: ... (gdb) break *compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x400610: file tmp-dw2-dir-file-name.c, line 999.^M ... and make the test-case independent of prologue analysis. This requires us to update the expected patterns. The fix ensures that once the aarch64 architecture-specific prologue skipper will be fixed, this test-case won't start failing. Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp --- gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp | 8 ++++---- gdb/testsuite/lib/gdb.exp | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp index 4d3f767f597..4c4c1ff07af 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp @@ -396,20 +396,20 @@ proc test { func compdir filename } { error "not absolute" } - gdb_breakpoint $func + gdb_breakpoint *$func gdb_continue_to_breakpoint $func "$func \\(\\) at .*" gdb_test_no_output "set filename-display absolute" verbose -log "expect: ${absolute}" - gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute" + gdb_test "frame" "#0 $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute" gdb_test_no_output "set filename-display basename" verbose -log "expect: [file tail $filename]" - gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename" + gdb_test "frame" "#0 $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename" gdb_test_no_output "set filename-display relative" verbose -log "expect: $filename" - gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative" + gdb_test "frame" "#0 $func \\(\\) at [string_to_regexp $filename]:999" "relative" } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a8f25b5f0dd..70fc019eeb9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -787,9 +787,14 @@ proc gdb_continue_to_breakpoint {name {location_pattern .*}} { global gdb_prompt set full_name "continue to breakpoint: $name" + set re_at_in " (at|in) " + if { [regexp $re_at_in $location_pattern] } { + set re_at_in " " + } + set kfail_pattern "Process record does not support instruction 0xfae64 at.*" gdb_test_multiple "continue" $full_name { - -re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" { + -re "(?:Breakpoint|Temporary breakpoint) .*$re_at_in$location_pattern\r\n$gdb_prompt $" { pass $full_name } -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {