From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21887 invoked by alias); 17 Feb 2011 09:54:14 -0000 Received: (qmail 21878 invoked by uid 22791); 17 Feb 2011 09:54:12 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate4.uk.ibm.com (HELO mtagate4.uk.ibm.com) (194.196.100.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Feb 2011 09:54:05 +0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p1H9s1XQ000501 for ; Thu, 17 Feb 2011 09:54:01 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1H9s75K1642606 for ; Thu, 17 Feb 2011 09:54:07 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1H9s0Hh010566 for ; Thu, 17 Feb 2011 02:54:00 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p1H9rxCI010550 for ; Thu, 17 Feb 2011 02:53:59 -0700 Message-Id: <201102170953.p1H9rxCI010550@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 17 Feb 2011 10:53:59 +0100 Subject: [rfc, testsuite] Standardize tests for HW watchpoint capabilities To: gdb-patches@sourceware.org Date: Thu, 17 Feb 2011 10:18:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2011-02/txt/msg00416.txt.bz2 Hello, support for hardware breakpoints/watchpoints varies wildly between different architectures. This makes it difficult to write test cases that do not cause spurious failures on some platforms simply because they miss certain capabilities. Test cases today attempt to handle this by explicit "istarget" checks, but not all of those are fully correct, and some are missing completely. In addition, this also makes it more difficult to update tests when hardware breakpoints/watchpoint capabilities have been added to a new target. To fix these problems, I've added a couple of new skip_..._tests procedures to lib/gdb.exp, and have updated all related test cases to make use of those procedures instead of open-coding checks. The new procedures allow checking for: - skip_hw_breakpoint_tests: Guards tests of hardware breakpoints - skip_hw_watchpoint_tests: Guards tests of hardware watchpoints - skip_hw_watchpoint_multi_tests: Guards tests that require more than one hardware watchpoint to be active at the same time - skip_hw_watchpoint_access_tests: Guards tests that require read or access type hardware watchpoints I've tested the patch below with no regressions on i386-linux, powerpc(64)-linux and s390(x)-linux. In particular, the following failures are fixed by no longer running tests that make use of unsupported features: - s390: gdb.base/watch-read.exp - powerpc: gdb.threads/local-watch-wrong-thread.exp - powerpc: gdb.threads/watchthreads.exp The following tests are now (successfully) run, which were previously being erroneously skipped: - powerpc: gdb.base/watchpoint-hw.exp - powerpc: gdb.base/watchpoint-hw-hit-once.exp Intel targets continue to (successfully) run all of the tests modified by this patch. Any comments? I'm planning to commit this in a couple of days ... Bye, Ulrich ChangeLog: * lib/gdb.exp (skip_hw_breakpoint_tests): New procedure. (skip_hw_watchpoint_tests): Likewise. (skip_hw_watchpoint_multi_tests): Likewise. (skip_hw_watchpoint_access_tests): Likewise. * gdb.base/hbreak.exp: Use appropriate skip_hw_..._tests checks. * gdb.base/pr11022.exp: Likewise. * gdb.base/watch-read.exp: Likewise. * gdb.base/watch_thread_num.exp: Likewise. * gdb.base/watchpoint-hw-hit-once.exp: Likewise. * gdb.base/watchpoint-hw.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.threads/local-watch-wrong-thread.exp: Likewise. * gdb.threads/watchthreads-reorder.exp: Likewise. * gdb.threads/watchthreads.exp: Likewise. * gdb.threads/watchthreads2.exp: Likewise. Index: gdb/testsuite/gdb.base/hbreak.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/hbreak.exp,v retrieving revision 1.4 diff -u -p -r1.4 hbreak.exp --- gdb/testsuite/gdb.base/hbreak.exp 1 Jan 2011 15:33:42 -0000 1.4 +++ gdb/testsuite/gdb.base/hbreak.exp 16 Feb 2011 18:30:03 -0000 @@ -13,12 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set. -if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] - && ![istarget "ia64-*-*"]) - || [target_info exists gdb,no_hardware_watchpoints]} then { - verbose "Skipping hbreak test." - return +if {[skip_hw_breakpoint_tests]} { + return 0 } set test hbreak Index: gdb/testsuite/gdb.base/pr11022.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pr11022.exp,v retrieving revision 1.4 diff -u -p -r1.4 pr11022.exp --- gdb/testsuite/gdb.base/pr11022.exp 1 Jan 2011 15:33:42 -0000 1.4 +++ gdb/testsuite/gdb.base/pr11022.exp 16 Feb 2011 18:30:03 -0000 @@ -17,10 +17,8 @@ if $tracelevel then { strace $tracelevel } -if [target_info exists gdb,no_hardware_watchpoints] { - # This test requires HW watchpoints - untested pr11022.exp - return -1 +if {[skip_hw_watchpoint_tests]} { + return 0 } set testfile "pr11022" Index: gdb/testsuite/gdb.base/watch-read.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watch-read.exp,v retrieving revision 1.2 diff -u -p -r1.2 watch-read.exp --- gdb/testsuite/gdb.base/watch-read.exp 1 Jan 2011 15:33:43 -0000 1.2 +++ gdb/testsuite/gdb.base/watch-read.exp 16 Feb 2011 18:30:03 -0000 @@ -27,9 +27,8 @@ set testfile "watch-read" set srcfile ${testfile}.c -if { [target_info exists gdb,no_hardware_watchpoints] } { - untested ${testfile}.exp - return -1 +if {[skip_hw_watchpoint_access_tests]} { + return 0 } if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { Index: gdb/testsuite/gdb.base/watch_thread_num.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watch_thread_num.exp,v retrieving revision 1.13 diff -u -p -r1.13 watch_thread_num.exp --- gdb/testsuite/gdb.base/watch_thread_num.exp 1 Jan 2011 15:33:43 -0000 1.13 +++ gdb/testsuite/gdb.base/watch_thread_num.exp 16 Feb 2011 18:30:03 -0000 @@ -25,8 +25,8 @@ if $tracelevel then { # This test verifies that a watchpoint is detected in the proper thread # so the test is only meaningful on a system with hardware watchpoints. -if [target_info exists gdb,no_hardware_watchpoints] { - return 0; +if {[skip_hw_watchpoint_tests]} { + return 0 } set testfile watch_thread_num Index: gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp,v retrieving revision 1.4 diff -u -p -r1.4 watchpoint-hw-hit-once.exp --- gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp 1 Jan 2011 15:33:43 -0000 1.4 +++ gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp 16 Feb 2011 18:30:03 -0000 @@ -13,12 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set. -if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] - && ![istarget "ia64-*-*"]) - || [target_info exists gdb,no_hardware_watchpoints]} then { - verbose "Skipping watchpoint-hw-hit-once test." - return +if {[skip_hw_watchpoint_access_tests]} { + return 0 } set test watchpoint-hw-hit-once Index: gdb/testsuite/gdb.base/watchpoint-hw.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint-hw.exp,v retrieving revision 1.4 diff -u -p -r1.4 watchpoint-hw.exp --- gdb/testsuite/gdb.base/watchpoint-hw.exp 1 Jan 2011 15:33:43 -0000 1.4 +++ gdb/testsuite/gdb.base/watchpoint-hw.exp 16 Feb 2011 18:30:03 -0000 @@ -13,12 +13,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set. -if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] - && ![istarget "ia64-*-*"] && ![istarget "s390*-*-*"]) - || [target_info exists gdb,no_hardware_watchpoints]} then { - verbose "Skipping watchpoint-hw test." - return + +if {[skip_hw_watchpoint_tests]} { + return 0 } set testfile watchpoint-hw Index: gdb/testsuite/gdb.base/watchpoint.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v retrieving revision 1.34 diff -u -p -r1.34 watchpoint.exp --- gdb/testsuite/gdb.base/watchpoint.exp 1 Jan 2011 15:33:43 -0000 1.34 +++ gdb/testsuite/gdb.base/watchpoint.exp 16 Feb 2011 18:30:04 -0000 @@ -688,10 +688,10 @@ proc test_inaccessible_watchpoint {} { "$watchpoint_msg \[0-9\]+: \-location: \\*global_ptr" delete_breakpoints - # This step requires two HW watchpoints. Since PPC Server only has - # a single one, it will use a SW watchpoint in this case. - if [istarget powerpc64-*] { - set watchpoint_msg "Watchpoint" + # This step requires two HW watchpoints. Since some platforms only + # have a single one, accept either SW or HW watchpoint in this case. + if {[skip_hw_watchpoint_multi_tests]} { + set watchpoint_msg "(Watchpoint|Hardware watchpoint)" } gdb_test "watch *global_ptr" "$watchpoint_msg \[0-9\]+: \\\*global_ptr" Index: gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp,v retrieving revision 1.5 diff -u -p -r1.5 local-watch-wrong-thread.exp --- gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp 1 Jan 2011 15:33:50 -0000 1.5 +++ gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp 16 Feb 2011 18:30:04 -0000 @@ -19,8 +19,8 @@ # thread other than the thread the local watchpoint was set in stops # for a breakpoint. -if [target_info exists gdb,no_hardware_watchpoints] { - return 0; +if {[skip_hw_watchpoint_multi_tests]} { + return 0 } set testfile "local-watch-wrong-thread" Index: gdb/testsuite/gdb.threads/watchthreads-reorder.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads-reorder.exp,v retrieving revision 1.4 diff -u -p -r1.4 watchthreads-reorder.exp --- gdb/testsuite/gdb.threads/watchthreads-reorder.exp 1 Jan 2011 15:33:50 -0000 1.4 +++ gdb/testsuite/gdb.threads/watchthreads-reorder.exp 16 Feb 2011 18:30:04 -0000 @@ -25,9 +25,8 @@ # could be assigned during continuation of a thread with pending SIGTRAP to the # different/new watchpoint, just based on the watchpoint/debug register number. -if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] - && ![istarget "ia64-*-*"]) - || [target_info exists gdb,no_hardware_watchpoints] +if {[skip_hw_watchpoint_access_tests] + || [skip_hw_watchpoint_multi_tests] || ![istarget *-*-linux*]} { return 0 } Index: gdb/testsuite/gdb.threads/watchthreads.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads.exp,v retrieving revision 1.14 diff -u -p -r1.14 watchthreads.exp --- gdb/testsuite/gdb.threads/watchthreads.exp 1 Jan 2011 15:33:50 -0000 1.14 +++ gdb/testsuite/gdb.threads/watchthreads.exp 16 Feb 2011 18:30:04 -0000 @@ -24,8 +24,8 @@ if $tracelevel { # This test verifies that a watchpoint is detected in the proper thread # so the test is only meaningful on a system with hardware watchpoints. -if [target_info exists gdb,no_hardware_watchpoints] { - return 0; +if {[skip_hw_watchpoint_multi_tests]} { + return 0 } proc target_no_stopped_data { } { Index: gdb/testsuite/gdb.threads/watchthreads2.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads2.exp,v retrieving revision 1.6 diff -u -p -r1.6 watchthreads2.exp --- gdb/testsuite/gdb.threads/watchthreads2.exp 1 Jan 2011 15:33:50 -0000 1.6 +++ gdb/testsuite/gdb.threads/watchthreads2.exp 16 Feb 2011 18:30:04 -0000 @@ -28,8 +28,8 @@ if $tracelevel { # This test verifies that a watchpoint is detected in the proper thread # so the test is only meaningful on a system with hardware watchpoints. -if [target_info exists gdb,no_hardware_watchpoints] { - return 0; +if {[skip_hw_watchpoint_tests]} { + return 0 } set testfile "watchthreads2" Index: gdb/testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.162 diff -u -p -r1.162 gdb.exp --- gdb/testsuite/lib/gdb.exp 1 Jan 2011 15:33:51 -0000 1.162 +++ gdb/testsuite/lib/gdb.exp 16 Feb 2011 18:30:05 -0000 @@ -1782,6 +1782,76 @@ proc skip_inline_var_tests {} { return 0 } +# Return a 1 if we should skip tests that require hardware breakpoints + +proc skip_hw_breakpoint_tests {} { + # Skip tests if requested by the board (note that no_hardware_watchpoints + # disables both watchpoints and breakpoints) + if { [target_info exists gdb,no_hardware_watchpoints]} { + return 1 + } + + # These targets support hardware breakpoints natively + if { [istarget "i?86-*-*"] + || [istarget "x86_64-*-*"] + || [istarget "ia64-*-*"] } { + return 0 + } + + return 1 +} + +# Return a 1 if we should skip tests that require hardware watchpoints + +proc skip_hw_watchpoint_tests {} { + # Skip tests if requested by the board + if { [target_info exists gdb,no_hardware_watchpoints]} { + return 1 + } + + # These targets support hardware watchpoints natively + if { [istarget "i?86-*-*"] + || [istarget "x86_64-*-*"] + || [istarget "ia64-*-*"] + || [istarget "powerpc*-*-linux*"] + || [istarget "s390*-*-*"] } { + return 0 + } + + return 1 +} + +# Return a 1 if we should skip tests that require *multiple* hardware +# watchpoints to be active at the same time + +proc skip_hw_watchpoint_multi_tests {} { + if { [skip_hw_watchpoint_tests] } { + return 1 + } + + # These targets support just a single hardware watchpoint + if { [istarget "powerpc*-*-linux*"] } { + return 1 + } + + return 0 +} + +# Return a 1 if we should skip tests that require read/access watchpoints + +proc skip_hw_watchpoint_access_tests {} { + if { [skip_hw_watchpoint_tests] } { + return 1 + } + + # These targets support just write watchpoints + if { [istarget "s390*-*-*"] } { + return 1 + } + + return 0 +} + set compiler_info "unknown" set gcc_compiled 0 set hp_cc_compiler 0 -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com