From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 7522D3858407; Thu, 4 Aug 2022 17:54:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7522D3858407 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix ERROR in gdb.base/watchpoint-unaligned.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 60adf22c1440723435262b9d867ebd76300c3325 X-Git-Newrev: 3c71833c67492ff23bf7f59b25720f06c5a4956f Message-Id: <20220804175441.7522D3858407@sourceware.org> Date: Thu, 4 Aug 2022 17:54:41 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2022 17:54:41 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D3c71833c6749= 2ff23bf7f59b25720f06c5a4956f commit 3c71833c67492ff23bf7f59b25720f06c5a4956f Author: Tom de Vries Date: Thu Aug 4 19:54:38 2022 +0200 [gdb/testsuite] Fix ERROR in gdb.base/watchpoint-unaligned.exp =20 In PR23888 an error is reported: ... ERROR: tcl error sourcing watchpoint-unaligned.exp. ERROR: expected boolean value but got "" while executing "if {$wpnum} { ... =20 This presumably happens when: - skip_hw_watchpoint_tests returns 0 meaning hw watchpoints are support= ed - gdb fails to set a hw watchpoint and instead sets a sw watchpoint =20 That particular situation is handled for arm: ... -re "Watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" { if {[istarget "arm*-*-*"]} { untested $test set wpnum 0 } } ... but not for any other targets so wpnum remains "", triggering the ERROR. =20 Possibly this has been fixed for powerpc by commit 8d4e4d13afb ("gdb Po= wer 9 add test for HW watchpoint support."), but it's still possible for other targets. =20 Fix this by: - initializing wpnum to 0 instead of "" - signalling the failure to set a hw watchpoint by a fail =20 Tested on x86_64-linux, also by adding: ... gdb_test_no_output "set can-use-hw-watchpoints 0" ... and verifying that it triggers the fail. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D23888 Diff: --- gdb/testsuite/gdb.base/watchpoint-unaligned.exp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuit= e/gdb.base/watchpoint-unaligned.exp index 4dbd3692995..00c6ebcf4eb 100644 --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp @@ -157,15 +157,17 @@ if ![runto_main] { } gdb_breakpoint [gdb_get_line_number "final_return"] "Breakpoint $decimal a= t $hex" "final_return" set test {watch data.u.size8twice[1]} -set wpnum "" +set wpnum 0 gdb_test_multiple $test $test { -re "Hardware watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" { set wpnum $expect_out(1,string) + pass $gdb_test_name } -re "Watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" { if {[istarget "arm*-*-*"]} { - untested $test - set wpnum 0 + untested $gdb_test_name + } else { + fail $gdb_test_name } } }