This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[gdb/38] Watchpoint does not trigger when first set - testsuite
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 06 Aug 2008 15:15:03 -0400
- Subject: [gdb/38] Watchpoint does not trigger when first set - testsuite
Hello,
This patch changes gdb.base/watchpoint test to cover hardware watchpoints. Currently it passes due to the fact it uses software watchpoints only.
The change leaves test for software watchpoint but adds test for hardware watchpoint and introduces new FAIL-s on linux. On targets without hardware watchpoint support, the new tests are not performed.
Thanks,
Aleksandar Ristovski
QNX Software Systems
2008-08-06 Aleksandar Ristovski <aristovski@qnx.com>
* gdb.base/watchpoint.c (func3): Add new variable for testing
support for hardware watchpoint after break.
* gdb.base/watchpoint (test_watchpoint_and_breakpoint): Add function
arguments to be reused for both software and hardware watchpoint.
Index: gdb/testsuite/gdb.base/watchpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.c,v
retrieving revision 1.3
diff -u -p -r1.3 watchpoint.c
--- gdb/testsuite/gdb.base/watchpoint.c 3 Mar 2008 13:24:12 -0000 1.3
+++ gdb/testsuite/gdb.base/watchpoint.c 6 Aug 2008 18:59:58 -0000
@@ -90,11 +90,14 @@ func3 ()
{
int x;
int y;
+ int hw;
x = 0;
x = 1; /* second x assignment */
y = 1;
y = 2;
+ hw = 0;
+ hw = 1; /* second hw assignment */
}
int
Index: gdb/testsuite/gdb.base/watchpoint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v
retrieving revision 1.18
diff -u -p -r1.18 watchpoint.exp
--- gdb/testsuite/gdb.base/watchpoint.exp 15 Apr 2008 14:33:54 -0000 1.18
+++ gdb/testsuite/gdb.base/watchpoint.exp 6 Aug 2008 18:59:58 -0000
@@ -624,22 +624,22 @@ proc test_complex_watchpoint {} {
}
}
-proc test_watchpoint_and_breakpoint {} {
+proc test_watchpoint_and_breakpoint { break_string watchwhat hw msg } {
global gdb_prompt
# This is a test for PR gdb/38, which involves setting a
# watchpoint right after you've reached a breakpoint.
if [runto func3] then {
- gdb_breakpoint [gdb_get_line_number "second x assignment"]
- gdb_continue_to_breakpoint "second x assignment"
- gdb_test "watch x" ".*atchpoint \[0-9\]+: x"
- gdb_test_multiple "next" "next after watch x" {
- -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
- pass "next after watch x"
+ gdb_breakpoint [gdb_get_line_number $break_string]
+ gdb_continue_to_breakpoint $break_string
+ gdb_test "watch $watchwhat" "$hw.*atchpoint \[0-9\]+: $watchwhat"
+ gdb_test_multiple "continue" "$msg" {
+ -re ".*atchpoint \[0-9\]+: $watchwhat\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
+ pass $msg
}
- -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" {
- kfail "gdb/38" "next after watch x"
+ default {
+ fail "gdb/38" "$msg"
}
}
}
@@ -832,7 +832,18 @@ if [initialize] then {
initialize
}
- test_watchpoint_and_breakpoint
+ send_gdb "set can-use-hw-watchpoints 0\n"
+ test_watchpoint_and_breakpoint "second x assignment" "x" "" \
+ "Next after software watch x"
+
+ # test again, but now with hw watchpoints
+ if ![target_info exists gdb,no_hardware_watchpoints] {
+ send_gdb "set can-use-hw-watchpoints 1\n"
+ test_watchpoint_and_breakpoint "second hw assignment" "hw" "Hardware" \
+ "Next after hardware watch hw"
+ }
+
+
}
# Restore old timeout