2011-07-26 Pedro Alves <pedro@codesourcery.com>
authorPedro Alves <palves@redhat.com>
Tue, 26 Jul 2011 19:39:59 +0000 (19:39 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 26 Jul 2011 19:39:59 +0000 (19:39 +0000)
gdb/
* breakpoint.c (works_in_software_mode_watchpoint): Also return
true for software watchpoints.

gdb/testsuite/
* gdb.base/watchpoint.exp
(test_disable_enable_software_watchpoint): New procedure.
(top level): Run it.

gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/watchpoint.exp

index a0d3606d5813bc4e2ce52e806a2a6dc34800f4f8..96f527b4e4d80383724549206f2cb23a8822e288 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-26  Pedro Alves  <pedro@codesourcery.com>
+
+       * breakpoint.c (works_in_software_mode_watchpoint): Also return
+       true for software watchpoints.
+
 2011-07-26  Joel Brobecker  <brobecker@adacore.com>
 
        GDB 7.3 released.
index 5afda31aeabba38e7c5cdbfd602efe2d45eeb4d5..00fe74823634fca3079c03bd9e5afdd1b08b955a 100644 (file)
@@ -8637,7 +8637,8 @@ resources_needed_watchpoint (const struct bp_location *bl)
 static int
 works_in_software_mode_watchpoint (const struct breakpoint *b)
 {
-  return b->type == bp_hardware_watchpoint;
+  /* Read and access watchpoints only work with hardware support.  */
+  return b->type == bp_watchpoint || b->type == bp_hardware_watchpoint;
 }
 
 static enum print_stop_action
index 1eeeeb29e782abd1e640a59b07efd7a83efbcaef..801124744d46fd9a0fb169d3e4e1d398b501d239 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-26  Pedro Alves  <pedro@codesourcery.com>
+
+       * gdb.base/watchpoint.exp
+       (test_disable_enable_software_watchpoint): New procedure.
+       (top level): Run it.
+
 2011-07-26  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
        * gdb.python/py-mi.exp: Avoid '+' in filenames.  Call C version of
index 1d8c5bcbf6b31bc9e7b2827913d8edba99db7c38..331b18165b3582e0e4dda65ecdfb9a74e3e2be27 100644 (file)
@@ -630,6 +630,23 @@ proc test_constant_watchpoint {} {
     gdb_test_no_output "delete \$bpnum" "delete watchpoint `7 + count'"
 }
 
+proc test_disable_enable_software_watchpoint {} {
+    # This is regression test for a bug that caused `enable' to fail
+    # for software watchpoints.
+
+    # Watch something not memory to force a software watchpoint.
+    gdb_test {watch $pc} ".*atchpoint \[0-9\]+: .pc"
+
+    gdb_test_no_output "disable \$bpnum" "disable watchpoint `\$pc'"
+    gdb_test_no_output "enable \$bpnum" "reenable watchpoint `\$pc'"
+
+    gdb_test "info watchpoint \$bpnum" \
+       ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+.pc.*" \
+       "watchpoint `\$pc' is enabled"
+
+    gdb_test_no_output "delete \$bpnum" "delete watchpoint `\$pc'"
+}
+
 proc test_watch_location {} {
     gdb_breakpoint [gdb_get_line_number "func5 breakpoint here"]
     gdb_continue_to_breakpoint "func5 breakpoint here"
@@ -903,6 +920,8 @@ if [initialize] then {
 
     test_constant_watchpoint
 
+    test_disable_enable_software_watchpoint
+
     test_watch_location
 }