This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Extra error message from update_watchpoint
- From: "Andrew Burgess" <aburgess at broadcom dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 18 Oct 2013 10:20:38 +0100
- Subject: [PATCH] Extra error message from update_watchpoint
- Authentication-results: sourceware.org; auth=none
While working on this:
URL
I found the error message:
Expression cannot be implemented with read/access watchpoint.
is also issued when hardware watchpoints are turned off, this
error seems a little confusing as the problem is not the
expression, but that software read/access watchpoints is not
supported.
After the patch I've ADDED an extra error message:
Software read/access watchpoints not supported.
Which will be selected where appropriate.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-10-18 Andrew Burgess <aburgess@broadcom.com>
* breakpoint.c (update_watchpoint): Give a different error message
when software watchpoints are explicitly turned off.
gdb/testsuite/ChangeLog
2013-10-18 Andrew Burgess <aburgess@broadcom.com>
* gdb.base/watchpoint.exp: (test_no_hw_watchpoints): Update
expected results, add additional test.
(test_watch_register_location): New.
(do_tests): Call test_watch_register_location.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c630b87..6e87e22 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1946,8 +1946,13 @@ 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 (_("Software read/access watchpoints not supported."));
+ else
+ error (_("Expression cannot be implemented with "
+ "read/access watchpoint."));
+ }
else
b->base.type = bp_watchpoint;
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index e0d4f81..5a5f149 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..*" \
+ "Software read/access watchpoints not supported..*" \
"rwatch disallowed when can-set-hw-watchpoints cleared"
+ gdb_test "awatch ival3" \
+ "Software read/access watchpoints not supported..*" \
+ "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: