From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3296 invoked by alias); 7 Jul 2018 00:47:21 -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 3279 invoked by uid 89); 7 Jul 2018 00:47:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Jul 2018 00:47:19 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 7D4411E08D; Fri, 6 Jul 2018 20:47:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1530924437; bh=3uSwX/HYTh7KTw+C0aKLN7S45TKWzw65MvfaKaSg+5s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=k5URYlMPtYLfNYSnRS0+5/ZBVyzOjKr5869MRbi9KC4dS/kzMb0HHDrmerj7/8Atk g0z/S34lb9jjt8ZpASGynUPfj+/wwF0ok7ZE8NAU8Ie7VnM7h+s1bGlZzulQDZG/iJ JnBU95bPxxueEjh0Ot3wBrE6BMyEiRmCTD9RH5Kk= Subject: Re: [PATCH] gdb/testsuite: Run test when software watchpoints are used To: Andrew Burgess Cc: gdb-patches@sourceware.org References: <20180704164017.5849-1-andrew.burgess@embecosm.com> <20180706135950.GM2675@embecosm.com> <25d43a27477e9ac14c7a0a4dad19d580@simark.ca> <20180706232109.GR2675@embecosm.com> From: Simon Marchi Message-ID: Date: Sat, 07 Jul 2018 00:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180706232109.GR2675@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00158.txt.bz2 On 2018-07-06 07:21 PM, Andrew Burgess wrote: > OK, got you, something like this then: Yes, that looks good. However, the test doesn't really work for me here, even without this patch, I get a ton of failures. Does it work well for you on native x86_64? If so, I'm fine if you push the patch. Finding it why it fails on my machine is another story. Here's the gdb.log, for reference. https://pastebin.com/raw/izy5c0Eh I just noted two nits: > @@ -183,9 +186,10 @@ proc valid_addr_p {cmd offset width} { > } > > # Watch WIDTH bytes at BASE + OFFSET. CMD specifices the specific > -# type of watchpoint to use. If CMD is "hbreak", WIDTH is ignored. > +# type of watchpoint to use. If CMD is "hbreak", WIDTH is ignored. The > +# HW_WP_P flag tells us if harware watchpoints are enabled or not. "harware" > @@ -249,3 +266,22 @@ foreach always_inserted {"off" "on" } { > } > } > } > + > +# Run tests with hardware watchpoints disabled, then again with them > +# enabled (if this target supports hardware watchpoints). > +foreach hw_wp_p { 0 1 } { > + > + if { $hw_wp_p } { > + # Does this target support h/w watchpoints? > + if [target_info exists gdb,no_hardware_watchpoints] { continue } > + set prefix "hw-watch" > + } else { > + set prefix "sw-watch" > + } > + > + gdb_test_no_output "set can-use-hw-watchpoints ${hw_wp_p}" > + > + with_test_prefix $prefix { > + run_watchpoints_tests $hw_wp_p > + } > +} For just two variations, I am not sure we gain much in readability by doing a loop here. It might be clearer to do: run_tests_software_watchpoints if supports_hardware_watchpoints: run_tests_hardware_watchpoints I don't really mind, it's your choice. Simon