From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29070 invoked by alias); 16 Mar 2015 16:55:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28998 invoked by uid 89); 16 Mar 2015 16:55:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 16 Mar 2015 16:55:14 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2GGtBQe002330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Mar 2015 12:55:11 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GGtAuv023268; Mon, 16 Mar 2015 12:55:10 -0400 Message-ID: <55070AED.5020502@redhat.com> Date: Mon, 16 Mar 2015 16:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yao Qi CC: 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> <86vbi0gapg.fsf@gmail.com> In-Reply-To: <86vbi0gapg.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-03/txt/msg00463.txt.bz2 On 03/16/2015 04:37 PM, Yao Qi wrote: > gdb/testsuite: > > 2015-03-16 Yao Qi > > * gdb.base/watchpoint-reuse-slot.exp: Get the address of > buf.byte. > (valid_addr_p): New proc. > (top level): Skip tests if valid_addr_p returns false for > $cmd1 or $cmd2. Thanks. This one looks good to me, with the nits below addressed. > > 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 "address". Missing period. > +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" > + } > +} Fine with me to add this (some port might need it), but note you don't actually need it if you're only looking for the alignment, because 'buf' is always aligned, as that is the whole point of the union: union aligned_buf { char byte[12]; /* So that testing consistently starts on an aligned address. */ unsigned long long force_align; }; > + > +# 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} { ^^ Spurious double space. > + 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. Suggest: # The aarch64 Linux kernel port only accepts 4-byte aligned addresses # for hardware breakpoints and 8-byte aligned addresses for hardware # watchpoints. However, both GDB and GDBserver support unaligned # watchpoints by using more than one properly aligned watchpoint # register to represent the whole unaligned region. Breakpoint # addresses must still be aligned though. > + 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" { Thanks, Pedro Alves