Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix ERROR in gdb.base/watchpoint-unaligned.exp
Date: Thu, 28 Jul 2022 12:09:57 +0200	[thread overview]
Message-ID: <20220728100956.GA28055@delia.home> (raw)

Hi,

In PR23888 an error is reported:
...
ERROR: tcl error sourcing watchpoint-unaligned.exp.
ERROR: expected boolean value but got ""
    while executing
"if {$wpnum} {
...

This presumably happens when:
- skip_hw_watchpoint_tests returns 0 meaning hw watchpoints are supported
- gdb fails to set a hw watchpoint and instead sets a sw watchpoint

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.

Possibly this has been fixed for powerpc by commit 8d4e4d13afb ("gdb Power 9
add test for HW watchpoint support."), but it's still possible for other
targets.

Fix this by:
- initializing wpnum to 0 instead of ""
- signalling the failure to set a hw watchpoint by a fail

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.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23888

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix ERROR in gdb.base/watchpoint-unaligned.exp

---
 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/testsuite/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 at $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
 	}
     }
 }

             reply	other threads:[~2022-07-28 10:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 10:09 Tom de Vries via Gdb-patches [this message]
2022-08-04 17:34 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728100956.GA28055@delia.home \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox