From 638aa5a1bac0c3782b6c0a40a03743507c57741e Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 29 Oct 2013 16:33:42 +0000 Subject: [PATCH] Extra error message from update_watchpoint https://sourceware.org/ml/gdb-patches/2013-10/msg00551.html gdb/ChangeLog * breakpoint.c (update_watchpoint): Update error message and add an additional error message. gdb/testsuite/ChangeLog * gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional tests and update expected error message. (test_watch_register_location): New tests. (do_tests): Call test_watch_register_location. * gdb.base/watchpoints.exp: Update expected error message. --- gdb/ChangeLog | 5 +++++ gdb/breakpoint.c | 13 ++++++++++--- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.base/watchpoint.exp | 24 +++++++++++++++++++++++- gdb/testsuite/gdb.base/watchpoints.exp | 4 ++-- 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7381eb6b576..cd2e55bacf3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-10-31 Andrew Burgess + + * breakpoint.c (update_watchpoint): Update error message and add + an additional error message. + 2013-10-30 Andreas Arnez * s390-tdep.h: Rename to... diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 608463dc750..1782c99ea15 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1805,7 +1805,8 @@ update_watchpoint (struct watchpoint *b, int reparse) if (b->base.ops->works_in_software_mode (&b->base)) b->base.type = bp_watchpoint; else - error (_("Software read/access watchpoints not supported.")); + error (_("Can't set read/access watchpoint when " + "hardware watchpoints are disabled.")); } } else if (within_current_scope && b->exp) @@ -1946,8 +1947,14 @@ update_watchpoint (struct watchpoint *b, int reparse) } } else if (!b->base.ops->works_in_software_mode (&b->base)) - error (_("Expression cannot be implemented with " - "read/access watchpoint.")); + { + if (!can_use_hw_watchpoints) + error (_("Can't set read/access watchpoint when " + "hardware watchpoints are disabled.")); + else + error (_("Expression cannot be implemented with " + "read/access watchpoint.")); + } else b->base.type = bp_watchpoint; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index bdd775dc4c0..94601efa5ec 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-10-31 Andrew Burgess + + * gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional + tests and update expected error message. + (test_watch_register_location): New tests. + (do_tests): Call test_watch_register_location. + * gdb.base/watchpoints.exp: Update expected error message. + 2013-10-30 Andreas Arnez * gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index e0d4f810877..9576a9eadc3 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -825,8 +825,12 @@ proc test_no_hw_watchpoints {} { # refrains from using them. # gdb_test "rwatch ival3" \ - "Expression cannot be implemented with read/access watchpoint..*" \ + "Can't set read/access watchpoint when hardware watchpoints are disabled." \ "rwatch disallowed when can-set-hw-watchpoints cleared" + gdb_test "awatch ival3" \ + "Can't set read/access watchpoint when hardware watchpoints are disabled." \ + "awatch disallowed when can-set-hw-watchpoints cleared" + # Re-enable hardware watchpoints if necessary. if ![target_info exists gdb,no_hardware_watchpoints] { @@ -879,6 +883,22 @@ proc test_watchpoint_in_big_blob {} { gdb_test_no_output "delete \$bpnum" "delete watch buf" } +proc test_watch_register_location {} { + global no_hw + + if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} { + # Non-memory read/access watchpoints are not supported, they would + # require software read/access watchpoint support (which is not + # currently available). + gdb_test "rwatch \$pc" \ + "Expression cannot be implemented with read/access watchpoint..*" \ + "rwatch disallowed for register based expression" + gdb_test "awatch \$pc" \ + "Expression cannot be implemented with read/access watchpoint..*" \ + "awatch disallowed for register based expression" + } +} + # Start with a fresh gdb. set prev_timeout $timeout @@ -940,6 +960,8 @@ proc do_tests {} { test_wide_location_1 test_wide_location_2 + + test_watch_register_location } # On targets that can do hardware watchpoints, run the tests twice: diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp index b70e86cfa5b..4e21d14c7a5 100644 --- a/gdb/testsuite/gdb.base/watchpoints.exp +++ b/gdb/testsuite/gdb.base/watchpoints.exp @@ -41,10 +41,10 @@ with_test_prefix "before inferior start" { # and read watchpoints require hardware watchpoint support, with this # turned off these can't be created. gdb_test "awatch ival1" \ - "Software read/access watchpoints not supported." \ + "Can't set read/access watchpoint when hardware watchpoints are disabled." \ "create access watchpoint" gdb_test "rwatch ival1" \ - "Software read/access watchpoints not supported." \ + "Can't set read/access watchpoint when hardware watchpoints are disabled." \ "create read watchpoint" } -- 2.30.2