diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index bba97fa..f254773 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -120,6 +120,19 @@ func4 () buf[0] = 7; } +int global = 0; + +void test_watchpoint_condition () +{ + global = 1; + global = 2; + global = 3; + global = 4; + global = 5; + global = 6; + global = 7; +} + int main () { #ifdef usestubs @@ -197,5 +210,7 @@ int main () func4 (); + test_watchpoint_condition (); + return 0; } diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 3c20d10..7a4e567 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -833,6 +833,12 @@ if [initialize] then { } test_watchpoint_and_breakpoint + + gdb_test "set can-use-hw-watchpoints 1\n" "" "enable hardware watchpoints again" + runto test_watchpoint_condition + gdb_test "watch global if global%3 == 0" ".Hardware watchpoint.*" "watchpoint on global" + gdb_test "continue" ".*New value = 3.*" "continue until global is 3" + gdb_test "continue" ".*New value = 6.*" "continue until global is 6" } # Restore old timeout