From patchwork Mon Mar 16 16:37:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 5634 Received: (qmail 109874 invoked by alias); 16 Mar 2015 16:37:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 109863 invoked by uid 89); 16 Mar 2015 16:37:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 16 Mar 2015 16:37:38 +0000 Received: by pabyw6 with SMTP id yw6so69525787pab.2 for ; Mon, 16 Mar 2015 09:37:36 -0700 (PDT) X-Received: by 10.67.7.195 with SMTP id de3mr33302591pad.79.1426523856608; Mon, 16 Mar 2015 09:37:36 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id os6sm18170573pac.28.2015.03.16.09.37.34 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 16 Mar 2015 09:37:35 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] watchpoint-reuse-slot.exp: skip some tests on targets have different wp and bp registers References: <1426257692-30461-1-git-send-email-qiyaoltc@gmail.com> <5506CDF2.4090400@redhat.com> <864mplghxp.fsf@gmail.com> <5506F561.8020108@redhat.com> Date: Mon, 16 Mar 2015 16:37:31 +0000 In-Reply-To: <5506F561.8020108@redhat.com> (Pedro Alves's message of "Mon, 16 Mar 2015 15:23:13 +0000") Message-ID: <86vbi0gapg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Pedro Alves writes: > Yes, that makes sense. > >> >> The inner loop of test has two parts, "base + 0" and "base + 1", >> >> append prefix "$cmd1 x $cmd2: " >> with_test_prefix "$prefix: width $width, iter $x" { >> with_test_prefix "base + 0" { >> watch_command $cmd1 $x 0 $width >> stepi >> gdb_test_no_output "delete \$bpnum" >> } >> with_test_prefix "base + 1" { >> watch_command $cmd2 $x 1 $width >> stepi >> gdb_test_no_output "delete \$bpnum" >> } >> } >> >> if we skip "base + 1" part, do we skip "base + 0" too? if not, prefix in >> test summary "$cmd1 x $cmd2: " doesn't reflect the fact. > > I think skipping both is fine. OK, how about the patch below? diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp index 844bf3a..28839fe 100644 --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp @@ -133,6 +133,39 @@ delete_breakpoints set cur_addr [get_pc] +# The addrss of buf.byte +set buf_byte_addr "" +set test "get address of buf.byte" +gdb_test_multiple "p /d &buf.byte" "$test" { + -re " = ($decimal).*$gdb_prompt $" { + set buf_byte_addr $expect_out(1,string) + pass "$test" + } +} + +# Return true if the memory range [buf.byte + OFFSET, +WIDTH] can be +# monitored by CMD, otherwise return false. + +proc valid_addr_p {cmd offset width} { + global buf_byte_addr + + set addr [expr $buf_byte_addr + $offset] + if { [istarget "aarch64*-*-linux*"] } { + # aarch64 linux kernel accepts 4-byte aligned address for + # hardware breakpoint and 8-byte aligned address for hardware + # watchpoint. However, GDB and GDBserver use one or more + # watchpoint registers to represent the whole unaligned region + # while each individual is properly aligned. + if {$cmd == "hbreak" } { + if { [expr $addr % 4] != 0 } { + return 0 + } + } + } + + return 1 +} + # Watch WIDTH bytes at BASE + OFFSET. CMD specifices the specific # type of watchpoint to use. If CMD is "hbreak", WIDTH is ignored. @@ -172,6 +205,15 @@ foreach always_inserted {"off" "on" } { } for {set x 0} {$x < 4} {incr x} { + + if { ![valid_addr_p $cmd1 $x $width] + || ![valid_addr_p $cmd2 $x+1 $width] } { + # Skip tests if requested address or length + # of breakpoint or watchpoint don't meet + # target or kernel requirements. + continue + } + set prefix "always-inserted $always_inserted: " append prefix "$cmd1 x $cmd2: " with_test_prefix "$prefix: width $width, iter $x" {