This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
adjust watchpoint testing
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 09 Jun 2006 21:58:00 +0100
- Subject: adjust watchpoint testing
the recurse.exp test presume there are at least two hardware watchpoints. This
patch adds a gdb,hardware_watchpoint target info variable and adjust the test to
only test where two watchpoints are used, if they exist on the target.
I found it necessary to adjust the watchpoint.exp expected reply too.
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2006-06-09 Nathan Sidwell <nathan@codesourcery.com>
gdb/testsuite/
* gdb.base/recurse.exp: Add gdb,hardware_watchpoint target
info. Adjust testing to cope with a single watchpoint.
* gdb.base/watchpoint.exp: Adjust expected string.
Index: gdb/testsuite/gdb.base/recurse.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/recurse.exp,v
retrieving revision 1.5
diff -c -3 -p -r1.5 recurse.exp
*** gdb/testsuite/gdb.base/recurse.exp 19 Sep 2001 08:21:17 -0000 1.5
--- gdb/testsuite/gdb.base/recurse.exp 9 Jun 2006 20:50:09 -0000
*************** proc recurse_tests {} {
*** 47,52 ****
--- 47,56 ----
if [target_info exists gdb,no_hardware_watchpoints] {
gdb_test "set can-use-hw-watchpoints 0" "" ""
}
+ set nwatch 99
+ if [target_info exists gdb,hardware_watchpoints] {
+ set nwatch [target_info gdb,hardware_watchpoints]
+ }
if [runto recurse] then {
# First we need to step over the assignment of b, so it has a known
*************** proc recurse_tests {} {
*** 78,91 ****
# First we need to step over the assignment of b, so it has a known
# value.
gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in second instance"
- gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
- "set second instance watchpoint"
! # Continue until initial set of b (second instance).
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 5.*"\
! "continue to second instance watchpoint, first time"] then {
! gdb_suppress_tests;
}
# Continue inward for a few iterations
--- 82,98 ----
# First we need to step over the assignment of b, so it has a known
# value.
gdb_test "next" "if \\(a == 1\\)" "next over b = 0 in second instance"
! if { $nwatch > 1 } {
! gdb_test "watch b" ".*\[Ww\]atchpoint \[0-9]*: b" \
! "set second instance watchpoint"
!
! # Continue until initial set of b (second instance).
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 0.*New value = 5.*"\
! "continue to second instance watchpoint, first time"] then {
! gdb_suppress_tests;
! }
}
# Continue inward for a few iterations
*************** proc recurse_tests {} {
*** 98,128 ****
gdb_test "continue" "Breakpoint.* recurse \\(a=1\\).*" \
"continue to recurse (a = 1)"
! # Continue until second set of b (second instance).
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
! "continue to second instance watchpoint, second time"] then {
! gdb_suppress_tests;
}
!
! # Continue again. We should have a watchpoint go out of scope now
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*deleted.*recurse \\(a=6\\) .*" \
! "second instance watchpoint deleted when leaving scope"] then {
! gdb_suppress_tests;
! }
!
# Continue until second set of b (first instance).
# 24320 is allowed as the final value for b as that's the value
# b would have on systems with 16bit integers.
#
# We could fix the test program to deal with this too.
if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*b.*Old value = 10.*New value = \(3628800|24320\).*return.*" \
! "continue to first instance watchpoint, second time"] then {
gdb_suppress_tests
}
!
# Continue again. We should have a watchpoint go out of scope now.
#
# The former version expected the test to return to main().
--- 105,137 ----
gdb_test "continue" "Breakpoint.* recurse \\(a=1\\).*" \
"continue to recurse (a = 1)"
! if { $nwatch > 1 } {
! # Continue until second set of b (second instance).
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
! "continue to second instance watchpoint, second time"] then {
! gdb_suppress_tests;
! }
!
! # Continue again. We should have a watchpoint go out of scope now
! if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*deleted.*recurse \\(a=6\\) .*" \
! "second instance watchpoint deleted when leaving scope"] then {
! gdb_suppress_tests;
! }
}
!
# Continue until second set of b (first instance).
# 24320 is allowed as the final value for b as that's the value
# b would have on systems with 16bit integers.
#
# We could fix the test program to deal with this too.
if [gdb_test "continue" \
! "Continuing.*\[Ww\]atchpoint.*b.*Old value = 10.*New value = \(3628800|24320\).*return.*" \
! "continue to first instance watchpoint, second time"] then {
gdb_suppress_tests
}
!
# Continue again. We should have a watchpoint go out of scope now.
#
# The former version expected the test to return to main().
Index: gdb/testsuite/gdb.base/watchpoint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint.exp,v
retrieving revision 1.11
diff -c -3 -p -r1.11 watchpoint.exp
*** gdb/testsuite/gdb.base/watchpoint.exp 22 Mar 2004 14:24:18 -0000 1.11
--- gdb/testsuite/gdb.base/watchpoint.exp 9 Jun 2006 20:50:10 -0000
*************** proc initialize {} {
*** 120,126 ****
return 0;
}
-
return 1
}
--- 120,125 ----
*************** proc test_simple_watchpoint {} {
*** 148,154 ****
gdb_run_cmd
set timeout 600
gdb_expect {
! -re "Breakpoint 1, marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_simple_watchpoint"
}
-re ".*$gdb_prompt $" {
--- 147,153 ----
gdb_run_cmd
set timeout 600
gdb_expect {
! -re "Breakpoint 1, .*marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_simple_watchpoint"
}
-re ".*$gdb_prompt $" {
*************** proc test_disabling_watchpoints {} {
*** 314,320 ****
gdb_run_cmd
set timeout 600
gdb_expect {
! -re "Breakpoint 1, marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_disabling_watchpoints"
}
-re ".*$gdb_prompt $" {
--- 313,319 ----
gdb_run_cmd
set timeout 600
gdb_expect {
! -re "Breakpoint 1, .*marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_disabling_watchpoints"
}
-re ".*$gdb_prompt $" {