diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1995-04-09 21:05:37 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1995-04-09 21:05:37 +0000 |
commit | 4dc75a28f8972f27a2e107a0db5a2b80e612fde9 (patch) | |
tree | 2e055943fadc8cc38b327850758ac70f8d2fbc7d /gdb/testsuite | |
parent | 06ce5be9c9482ac9601ec9be6b61fa391000e7d1 (diff) | |
download | gdb-4dc75a28f8972f27a2e107a0db5a2b80e612fde9.zip gdb-4dc75a28f8972f27a2e107a0db5a2b80e612fde9.tar.gz gdb-4dc75a28f8972f27a2e107a0db5a2b80e612fde9.tar.bz2 |
* gdb.base/recurse.exp: Fix comment.
* TODO: Remove item about printing variables in nodebug.exp. Add
item about enabling tests which are only run on some targets.
* gdb.base/watchpoint.exp: Various cleanups (make each test pass or
fail, make test names unique, use new gdb_test convention
regarding pattern, use gdb_test more, etc.).
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/watchpoint.exp | 438 |
2 files changed, 178 insertions, 269 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 230e668..d1f43df 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ Sun Apr 9 09:02:36 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + * gdb.base/recurse.exp: Fix comment. + + * TODO: Remove item about printing variables in nodebug.exp. Add + item about enabling tests which are only run on some targets. + + * gdb.base/watchpoint.exp: Various cleanups (make each test pass or + fail, make test names unique, use new gdb_test convention + regarding pattern, use gdb_test more, etc.). + * gdb.base/bitfields.exp: Various cleanups (make each test pass or fail, make test names unique, etc.). diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index ddb3dae..74d98f2 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992 Free Software Foundation, Inc. +# Copyright (C) 1992, 1994 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -59,28 +59,34 @@ proc initialize {} { send "break marker1\n" expect { - -re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$prompt $" {} + -re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$prompt $" { + pass "set breakpoint at marker1" + } -re ".*$prompt $" { fail "set breakpoint at marker1" ; return 0 } timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 } } send "break marker2\n" expect { - -re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$prompt $" {} + -re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$prompt $" { + pass "set breakpoint at marker2" + } -re ".*$prompt $" { fail "set breakpoint at marker2" ; return 0 } timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 } } send "info break\n" expect { - -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { } - -re ".*$prompt $" { fail "breakpoints not setup right" ; return 0 } - timeout { fail "info break (timeout)" ; return 0 } + -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { pass "info break in watchpoint.exp" } + -re ".*$prompt $" { fail "info break in watchpoint.exp" ; return 0 } + timeout { fail "info break in watchpoint.exp (timeout)" ; return 0 } } send "watch ival3\n" expect { - -re ".*\[Ww\]atchpoint 3: ival3\r\n$prompt $" { pass "set watchpoint" } + -re ".*\[Ww\]atchpoint 3: ival3\r\n$prompt $" { + pass "set watchpoint on ival3" + } -re ".*$prompt $" { fail "set watchpoint on ival3" ; return 0 } timeout { fail "set watchpoint on ival3 (timeout)" ; return 0 } } @@ -92,8 +98,12 @@ proc initialize {} { -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$prompt $" { pass "watchpoint found in watchpoint/breakpoint table" } - -re ".*$prompt $" { fail "watchpoint/breakpoint not set" ; return 0 } - timeout { fail "info break (timeout)" ; return 0 } + -re ".*$prompt $" { + fail "watchpoint found in watchpoint/breakpoint table" ; return 0 + } + timeout { + fail "watchpoint found in watchpoint/breakpoint table" ; return 0 + } } # After installing the watchpoint, we disable it until we are ready @@ -102,9 +112,9 @@ proc initialize {} { send "disable 3\n" expect { - -re "disable 3\r\n$prompt $" { pass "watchpoint disabled" } - -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 } - timeout { fail "watchpoint not disabled (timeout)" ; return 0 } + -re "disable 3\r\n$prompt $" { pass "disable watchpoint" } + -re ".*$prompt $" { fail "disable watchpoint" ; return 0 } + timeout { fail "disable watchpoint (timeout)" ; return 0 } } return 1 @@ -123,142 +133,106 @@ proc test_simple_watchpoint {} { send "disable 3\n" expect { - -re "disable 3\r\n$prompt $" { } - -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 } - timeout { fail "watchpoint not disabled (timeout)" ; return 0 } + -re "^disable 3\r\n$prompt $" { + pass "disable watchpoint in test_simple_watchpoint" + } + -re ".*$prompt $" { + fail "disable watchpoint in test_simple_watchpoint" + return 0 + } + timeout { + fail "disable watchpoint in test_simple_watchpoint (timeout)" + return 0 + } } # Run until we get to the first marker function. - send "run\n" + gdb_run_cmd expect { - -re "The program .* has been started already.* \(y or n\) $" { - send "y\n" - exp_continue + -re "Breakpoint 1, marker1 .*$prompt $" { + pass "run to marker1 in test_simple_watchpoint" + } + -re ".*$prompt $" { + fail "run to marker1 in test_simple_watchpoint" + return + } + timeout { + fail "run to marker1 in test_simple_watchpoint (timeout)" + return } - -re "Starting program.*Breakpoint 1, marker1 .*$prompt $" {} - -re ".*$prompt $" { fail "run until marker1 function hit" ; return } - timeout { fail "run until marker1 function hit (timeout)" ; return } } # After reaching the marker function, enable the watchpoint. send "enable 3\n" expect { - -re "enable 3\r\n$prompt $" { pass "watchpoint enabled" } - -re ".*$prompt $" { fail "watchpoint not enabled" ; return } - timeout { fail "watchpoint not enabled (timeout)" ; return } + -re "^enable 3\r\n$prompt $" { pass "enable watchpoint" } + -re ".*$prompt $" { fail "enable watchpoint" ; return } + timeout { fail "enable watchpoint (timeout)" ; return } } - gdb_test "break func1" "Breakpoint.*at" - gdb_test "set \\\$func1_breakpoint_number = \\\$bpnum" "" + gdb_test "break func1" "Breakpoint.*at.*" + gdb_test "set \$func1_breakpoint_number = \$bpnum" "" - gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1" \ + gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1.*" \ "continue to breakpoint at func1" # Continue until the first change, from -1 to 0 send "cont\n" expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" { + -re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" { pass "watchpoint hit, first time" } - -re "Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*for .count = 0; count < 4; count\[+)\]+ \{.*$prompt $" { - # setup_xfail "m68*-*-sunos*" 1836 - fail "missed first watchpoint" - return - } -re "Continuing.*Breakpoint.*func1.*$prompt $" { setup_xfail "m68*-*-*" 2597 fail "thought it hit breakpoint at func1 twice" - gdb_test "delete \\\$func1_breakpoint_number" "" + gdb_test "delete \$func1_breakpoint_number" "" gdb_test "continue" "\ -Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \ +Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \ "watchpoint hit, first time" } - -re ".*$prompt $" { fail "missed first watchpoint" ; return } - timeout { fail "run to first watchpoint (timeout)" ; return } - eof { fail "run to first watchpoint (eof)" ; return } + -re ".*$prompt $" { fail "watchpoint hit, first time" ; return } + timeout { fail "watchpoint hit, first time (timeout)" ; return } + eof { fail "watchpoint hit, first time (eof)" ; return } } - gdb_test "delete \\\$func1_breakpoint_number" "" + gdb_test "delete \$func1_breakpoint_number" "" # Continue until the next change, from 0 to 1. - - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, second time" - } - -re ".*$prompt $" { fail "missed second watchpoint" ; return } - timeout { fail "run to second watchpoint (timeout)" ; return } - } - + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time" + # Continue until the next change, from 1 to 2. - - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, third time" - } - -re ".*$prompt $" { fail "missed third watchpoint" ; return } - timeout { fail "run to third watchpoint (timeout)" ; return } - } + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time" # Continue until the next change, from 2 to 3. - - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, fourth time" - } - -re ".*$prompt $" { fail "missed fourth watchpoint" ; return } - timeout { fail "run to fourth watchpoint (timeout)" ; return } - } - + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time" + # Continue until the next change, from 3 to 4. # Note that this one is outside the loop. - - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, fifth time" - } - -re ".*$prompt $" { fail "missed fifth watchpoint" ; return } - timeout { fail "run to fifth watchpoint (timeout)" ; return } - } - + + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time" + # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. - - # This used to fail for a29k-amd-udi (PR 2421), but has been fixed. - send "cont\n" - expect { - -re "Continuing.*Breakpoint.*marker2 \(\).*$prompt $" { } - -re "Continuing.*Watchpoint.*ival3.*$prompt $" { - fail "hit a disabled watchpoint" ; return - } - -re ".*$prompt $" { fail "marker2 function missed" ; return } - timeout { fail "run to marker2 function (timeout)" ; return } - } - + + gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \ + "continue to marker2" + # Disable the watchpoint so we run at full speed until we exit. send "disable 3\n" expect { - -re "disable 3\r\n$prompt $" { pass "watchpoint disabled" } - -re ".*$prompt $" { fail "watchpoint not disabled" ; return } - timeout { fail "watchpoint not disabled (timeout)" ; return } + -re "^disable 3\r\n$prompt $" { pass "watchpoint disabled" } + -re ".*$prompt $" { fail "watchpoint disabled" ; return } + timeout { fail "watchpoint disabled (timeout)" ; return } } # Run until process exits. - - send "cont\n" - expect { - -re "Continuing.*Program exited normally.*$prompt $" { } - -re ".*$prompt $" { fail "watchpoints not removed" ; return } - timeout { fail "looking for process exit (timeout)" } - } + + gdb_test "cont" "Continuing.*Program exited normally.*" \ + "continue to exit in test_simple_watchpoint" } # Test disabling watchpoints. @@ -274,105 +248,81 @@ proc test_disabling_watchpoints {} { send "disable 3\n" expect { - -re "disable 3\r\n$prompt $" { } - -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 } - timeout { fail "watchpoint not disabled (timeout)" ; return 0 } + -re "^disable 3\r\n$prompt $" { + pass "disable watchpoint in test_disabling_watchpoints" + } + -re ".*$prompt $" { + fail "disable watchpoint in test_disabling_watchpoints" + return 0 + } + timeout { + fail "disable watchpoint in test_disabling_watchpoints (timeout)" + return 0 + } } # Run until we get to the first marker function. - send "run\n" + gdb_run_cmd expect { - -re "The program .* has been started already.* \(y or n\) $" { - send "y\n" - exp_continue + -re "Breakpoint 1, marker1 .*$prompt $" { + pass "run to marker1 in test_disabling_watchpoints" + } + -re ".*$prompt $" { + fail "run to marker1 in test_disabling_watchpoints" + return + } + timeout { + fail "run to marker1 in test_disabling_watchpoints (timeout)" + return } - -re "Starting program.*Breakpoint 1, marker1 .*$prompt $" {} - -re ".*$prompt $" { fail "run until marker1 function hit" ; return } - timeout { fail "run until marker1 function hit (timeout)" ; return } } # After reaching the marker function, enable the watchpoint. send "enable 3\n" expect { - -re "enable 3\r\n$prompt $" { pass "watchpoint enabled" } - -re ".*$prompt $" { fail "watchpoint not enabled" ; return } - timeout { fail "watchpoint not enabled (timeout)" ; return } + -re "^enable 3\r\n$prompt $" { pass "watchpoint enabled" } + -re ".*$prompt $" { fail "watchpoint enabled" ; return } + timeout { fail "watchpoint enabled (timeout)" ; return } } # Continue until the first change, from -1 to 0 # Don't check the old value, because on VxWorks the variable value # will not have been reinitialized. - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, first time" - } - -re "Continuing.*Watchpoint.*ival3.*Old value = .*New value = 0.*for .count = 0; count < 4; count\[+)]+ \{.*$prompt $" { - # setup_xfail "m68*-*-sunos*" 1836 - fail "missed first watchpoint" - return - } - -re ".*$prompt $" { fail "missed first watchpoint" ; return } - timeout { fail "run to first watchpoint (timeout)" ; return } - } + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time" # Continue until the next change, from 0 to 1. - - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*$prompt $" { - pass "watchpoint hit, second time" - } - -re ".*$prompt $" { fail "missed second watchpoint" ; return } - timeout { fail "run to second watchpoint (timeout)" ; return } - } + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time" # Disable the watchpoint but leave breakpoints send "disable 3\n" expect { - -re "disable 3\r\n$prompt $" { } - -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 } - timeout { fail "watchpoint not disabled (timeout)" ; return 0 } - } - - # Check watchpoint list, looking for the entry that confirms the - # watchpoint is disabled. - - send "info watchpoints\n" - expect { - -re "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*$prompt $" { - pass "watchpoint disabled in table" + -re "^disable 3\r\n$prompt $" { + pass "disable watchpoint #2 in test_disabling_watchpoints" } -re ".*$prompt $" { - fail "disabled watchpoint not found in table" + "disable watchpoint #2 in test_disabling_watchpoints" + return 0 + } + timeout { + "disable watchpoint #2 in test_disabling_watchpoints (timeout)" + return 0 } - timeout { fail "info watchpoints (timeout)" } } + # Check watchpoint list, looking for the entry that confirms the + # watchpoint is disabled. + gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" + # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. - - send "cont\n" - expect { - -re "Continuing.*Breakpoint.*marker2 \[)(\]+.*$prompt $" { - pass "disabled watchpoint skipped" - } - -re "Continuing.*Watchpoint.*ival3.*$prompt $" { - fail "hit a disabled watchpoint" ; return - } - -re ".*$prompt $" { fail "marker2 function missed" ; return } - timeout { fail "run to marker2 function (timeout)" ; return } - } + gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \ + "disabled watchpoint skipped" - send "cont\n" - expect { - -re "Continuing.*Program exited normally.*$prompt $" { } - -re ".*$prompt $" { fail "watchpoints not removed" ; return } - timeout { fail "looking for process exit (timeout)" } - } + gdb_test "cont" "Continuing.*Program exited normally.*" \ + "continue to exit in test_disabling_watchpoints" } # Test stepping and other mundane operations with watchpoints enabled @@ -383,11 +333,11 @@ proc test_stepping {} { gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2" # Well, let's not be too mundane. It should be a *bit* of a challenge - gdb_test "break func2 if 0" "Breakpoint.*at" - gdb_test "p \\\$func2_breakpoint_number = \\\$bpnum" "=" + gdb_test "break func2 if 0" "Breakpoint.*at.*" + gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*" - # The HPPA has a problem here. - if [ istarget "hppa*-*-*" ] then { + # The HPPA has a problem here if it's not using hardware watchpoints + if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then { # Don't actually try doing the call, if we do we can't continue. setup_xfail "*-*-*" fail "calling function with watchpoint enabled" @@ -407,6 +357,7 @@ proc test_stepping {} { clear_xfail "alpha-*-*" clear_xfail "mips*-*-*" clear_xfail "sparc-*-*" + clear_xfail "hppa*-*-*bsd*" gdb_test "p func1 ()" "= 73" \ "calling function with watchpoint enabled" } @@ -418,17 +369,18 @@ proc test_stepping {} { # the alpha and might be caused by stack adjustment instructions # on other targets. In this case we will step once more. # + send "finish\n" expect { -re "Run.*exit from.*marker1.*main.* at" { } default { fail "finish from marker1" ; return } } expect { - -re "marker1 \[)(\]+;.*$prompt $" { + -re "marker1 \\(\\);.*$prompt $" { send "step\n" exp_continue } - -re "func1 \[)(\]+;.*$prompt $" { + -re "func1 \\(\\);.*$prompt $" { pass "finish from marker1" } -re ".*$prompt $" { @@ -437,7 +389,7 @@ proc test_stepping {} { default { fail "finish from marker1" ; return } } - gdb_test "next" "for \[(\]+count = 0" + gdb_test "next" "for \\(count = 0.*" "next to `for' in watchpoint.exp" # Now test that "until" works. It's a bit tricky to test # "until", because compilers don't always arrange the code @@ -448,12 +400,13 @@ proc test_stepping {} { # stepping through the loop once, and the debugger should not # stop for any of the remaining iterations. - gdb_test "until" "ival1 = count" - gdb_test "until" "ival3 = count" + gdb_test "until" "ival1 = count.*" "until to ival1 assignment" + gdb_test "until" "ival3 = count.*" "until to ival3 assignment" send "until\n" expect { - -re "(for \[(\]+count = 0|\}).*$prompt $" { - gdb_test "until" "ival1 = count; /. Outside loop ./" + -re "(for \\(count = 0|\}).*$prompt $" { + gdb_test "until" "ival1 = count; /. Outside loop ./" \ + "until out of loop" } -re "ival1 = count; /. Outside loop ./.*$prompt $" { pass "until out of loop" @@ -464,7 +417,7 @@ proc test_stepping {} { default { fail "until out of loop" ; return } } - gdb_test "step" "ival2 = count" + gdb_test "step" "ival2 = count.*" "step to ival2 assignment" } } @@ -480,18 +433,14 @@ proc test_watchpoint_triggered_in_syscall {} { set y 0 set testname "Watch buffer passed to read syscall" if [runto marker2] then { - gdb_test "watch buf\\\[0\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf" - gdb_test "watch buf\\\[1\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf" - gdb_test "watch buf\\\[2\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf" - gdb_test "watch buf\\\[3\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf" - gdb_test "watch buf\\\[4\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf" + gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]" + gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]" + gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]" + gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]" + gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]" gdb_test "break marker4" ".*Breakpoint.*" - send "set doread = 1\n" - expect { - -re ".*$prompt $" { } - timeout { fail "set doread" ; return } - } + gdb_test "set doread = 1" "" # Sometimes our string never gets to GDB?!? dejagnu bug? Whatever # the cause we'll set a reasonably short timeout and resend our @@ -500,10 +449,10 @@ proc test_watchpoint_triggered_in_syscall {} { send "continue\n" send "123\n" expect { - -re ".*Watchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*Watchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*Watchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*Watchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } -re ".*$prompt $" { } timeout { set timeout $saved_timeout @@ -521,62 +470,44 @@ proc test_watchpoint_triggered_in_syscall {} { expect { -re ".*= 49.*$prompt $" { set y [expr $y+1] } -re ".*= 0" { } - default { fail "bogus value in buf[0]" } - timeout { fail "retrieving contents of buf variable (timeout) } + default { } + timeout { } } send "print buf\[1\]\n" expect { -re ".*= 50.*$prompt $" { set y [expr $y+1] } -re ".*= 0" { } - default { fail "bogus value in buf[1]" } - timeout { fail "retrieving contents of buf variable (timeout) } + default { } + timeout { } } send "print buf\[2\]\n" expect { -re ".*= 51.*$prompt $" { set y [expr $y+1] } -re ".*= 0" { } - default { fail "bogus value in buf[2]" } - timeout { fail "retrieving contents of buf variable (timeout) } + default { } + timeout { } } send "print buf\[3\]\n" expect { -re ".*= 10.*$prompt $" { set y [expr $y+1] } -re ".*= 0" { } - default { fail "bogus value in buf[3]" } - timeout { fail "retrieving contents of buf variable (timeout) } + default { } + timeout { } } # Did we find what we were looking for? If not, flunk it. - if [expr $x==$y] then { pass $testname } else { fail "$testname: Only triggered $x watchpoints, expected $y."} + if [expr $x==$y] then { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"} # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. + gdb_test "cont" "Continuing.*Breakpoint.*marker4 \\(\\).*" \ + "continue to marker4" - send "cont\n" - expect { - -re "Continuing.*Breakpoint.*marker4 \[)(\]+.*$prompt $" { - pass "disabled watchpoint skipped" - } - -re "Continuing.*Watchpoint.*$prompt $" { - fail "hit suprious watchpoint" ; return - } - -re ".*$prompt $" { fail "marker4 function missed" ; return } - timeout { fail "run to marker4 function (timeout)" ; return } - } - # Disable everything so we can finish the program at full speed - send "disable\n" - expect { - -re ".*$prompt $" { } - timeout { fail "disabling breakpoints (timeout)" } - } + gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall" - send "cont\n" - expect { - -re "Continuing.*Program exited normally.*$prompt $" { } - -re ".*$prompt $" { fail "watchpoints not removed" ; return } - timeout { fail "looking for process exit (timeout)" } - } + gdb_test "cont" "Continuing.*Program exited normally.*" \ + "continue to exit in test_watchpoint_triggered_in_syscall" } } @@ -586,45 +517,23 @@ proc test_watchpoint_triggered_in_syscall {} { proc test_complex_watchpoint {} { global prompt - set testname "Test complex watchpoint" if [runto marker4] then { gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val" gdb_test "break marker5" ".*Breakpoint.*" - send "cont\n" - expect { - -re "Continuing.*Watchpoint.*ptr1->val.*Old value = 1.*New value = 2.*$prompt $" { pass $testname } - default { fail $testname ; return } - } + gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ptr1->val.*Old value = 1.*New value = 2.*" "Test complex watchpoint" # Continue until we hit the marker5 function. # Make sure we hit no more watchpoints. - send "cont\n" - expect { - -re "Continuing.*Breakpoint.*marker5 \[)(\]+.*$prompt $" { - pass "did not trigger wrong watchpoint" - } - -re "Continuing.*Watchpoint.*$prompt $" { - fail "hit wrong watchpoint" ; return - } - -re ".*$prompt $" { fail "marker5 function missed" ; return } - timeout { fail "run to marker5 function (timeout)" ; return } - } + gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \ + "did not trigger wrong watchpoint" # Disable everything so we can finish the program at full speed - send "disable\n" - expect { - -re ".*$prompt $" { } - timeout { fail "disabling breakpoints (timeout)" } - } + gdb_test "disable" "" "disable in test_complex_watchpoint" - send "cont\n" - expect { - -re "Continuing.*Program exited normally.*$prompt $" { } - -re ".*$prompt $" { fail "watchpoints not removed" ; return } - timeout { fail "looking for process exit (timeout)" } - } + gdb_test "cont" "Continuing.*Program exited normally.*" \ + "continue to exit in test_complex_watchpoint" } } @@ -657,12 +566,6 @@ if [initialize] then { initialize } - if [istarget "a29k-*-udi"] then { - # FIXME: If PR 2415 is fixed, this is not needed. - gdb_target_udi - gdb_load $objdir/$subdir/$binfile - } - test_disabling_watchpoints # See above. @@ -685,8 +588,9 @@ if [initialize] then { initialize } - # This test hasn't been tested on anything but the PA. - if [istarget "hppa*-*-*"] then { + # Only enabled for some targets merely because it has not been tested + # elsewhere. + if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then { test_watchpoint_triggered_in_syscall } @@ -699,8 +603,9 @@ if [initialize] then { initialize } - # This test hasn't been tested on anything but the PA. - if [istarget "hppa*-*-*"] then { + # Only enabled for some targets merely because it has not been tested + # elsewhere. + if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then { test_complex_watchpoint } @@ -708,8 +613,3 @@ if [initialize] then { set timeout $timeoutsave } - -if [istarget "a29k-*-udi"] then { - # FIXME: If PR 2415 is fixed, this is not needed. - gdb_target_udi -} |