* 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.).
This commit is contained in:
parent
06ce5be9c9
commit
4dc75a28f8
|
@ -1,5 +1,14 @@
|
||||||
Sun Apr 9 09:02:36 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
|
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
|
* gdb.base/bitfields.exp: Various cleanups (make each test pass or
|
||||||
fail, make test names unique, etc.).
|
fail, make test names unique, etc.).
|
||||||
|
|
||||||
|
|
|
@ -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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -59,28 +59,34 @@ proc initialize {} {
|
||||||
|
|
||||||
send "break marker1\n"
|
send "break marker1\n"
|
||||||
expect {
|
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 }
|
-re ".*$prompt $" { fail "set breakpoint at marker1" ; return 0 }
|
||||||
timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 }
|
timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
send "break marker2\n"
|
send "break marker2\n"
|
||||||
expect {
|
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 }
|
-re ".*$prompt $" { fail "set breakpoint at marker2" ; return 0 }
|
||||||
timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 }
|
timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
send "info break\n"
|
send "info break\n"
|
||||||
expect {
|
expect {
|
||||||
-re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { }
|
-re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { pass "info break in watchpoint.exp" }
|
||||||
-re ".*$prompt $" { fail "breakpoints not setup right" ; return 0 }
|
-re ".*$prompt $" { fail "info break in watchpoint.exp" ; return 0 }
|
||||||
timeout { fail "info break (timeout)" ; return 0 }
|
timeout { fail "info break in watchpoint.exp (timeout)" ; return 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
send "watch ival3\n"
|
send "watch ival3\n"
|
||||||
expect {
|
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 }
|
-re ".*$prompt $" { fail "set watchpoint on ival3" ; return 0 }
|
||||||
timeout { fail "set watchpoint on ival3 (timeout)" ; 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 $" {
|
-re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$prompt $" {
|
||||||
pass "watchpoint found in watchpoint/breakpoint table"
|
pass "watchpoint found in watchpoint/breakpoint table"
|
||||||
}
|
}
|
||||||
-re ".*$prompt $" { fail "watchpoint/breakpoint not set" ; return 0 }
|
-re ".*$prompt $" {
|
||||||
timeout { fail "info break (timeout)" ; return 0 }
|
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
|
# After installing the watchpoint, we disable it until we are ready
|
||||||
|
@ -102,9 +112,9 @@ proc initialize {} {
|
||||||
|
|
||||||
send "disable 3\n"
|
send "disable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "disable 3\r\n$prompt $" { pass "watchpoint disabled" }
|
-re "disable 3\r\n$prompt $" { pass "disable watchpoint" }
|
||||||
-re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
|
-re ".*$prompt $" { fail "disable watchpoint" ; return 0 }
|
||||||
timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
|
timeout { fail "disable watchpoint (timeout)" ; return 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
@ -123,142 +133,106 @@ proc test_simple_watchpoint {} {
|
||||||
|
|
||||||
send "disable 3\n"
|
send "disable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "disable 3\r\n$prompt $" { }
|
-re "^disable 3\r\n$prompt $" {
|
||||||
-re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
|
pass "disable watchpoint in test_simple_watchpoint"
|
||||||
timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
|
}
|
||||||
|
-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.
|
# Run until we get to the first marker function.
|
||||||
|
|
||||||
send "run\n"
|
gdb_run_cmd
|
||||||
expect {
|
expect {
|
||||||
-re "The program .* has been started already.* \(y or n\) $" {
|
-re "Breakpoint 1, marker1 .*$prompt $" {
|
||||||
send "y\n"
|
pass "run to marker1 in test_simple_watchpoint"
|
||||||
exp_continue
|
}
|
||||||
|
-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.
|
# After reaching the marker function, enable the watchpoint.
|
||||||
|
|
||||||
send "enable 3\n"
|
send "enable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "enable 3\r\n$prompt $" { pass "watchpoint enabled" }
|
-re "^enable 3\r\n$prompt $" { pass "enable watchpoint" }
|
||||||
-re ".*$prompt $" { fail "watchpoint not enabled" ; return }
|
-re ".*$prompt $" { fail "enable watchpoint" ; return }
|
||||||
timeout { fail "watchpoint not enabled (timeout)" ; return }
|
timeout { fail "enable watchpoint (timeout)" ; return }
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_test "break func1" "Breakpoint.*at"
|
gdb_test "break func1" "Breakpoint.*at.*"
|
||||||
gdb_test "set \\\$func1_breakpoint_number = \\\$bpnum" ""
|
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 to breakpoint at func1"
|
||||||
|
|
||||||
# Continue until the first change, from -1 to 0
|
# Continue until the first change, from -1 to 0
|
||||||
|
|
||||||
send "cont\n"
|
send "cont\n"
|
||||||
expect {
|
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"
|
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 $" {
|
-re "Continuing.*Breakpoint.*func1.*$prompt $" {
|
||||||
setup_xfail "m68*-*-*" 2597
|
setup_xfail "m68*-*-*" 2597
|
||||||
fail "thought it hit breakpoint at func1 twice"
|
fail "thought it hit breakpoint at func1 twice"
|
||||||
gdb_test "delete \\\$func1_breakpoint_number" ""
|
gdb_test "delete \$func1_breakpoint_number" ""
|
||||||
gdb_test "continue" "\
|
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"
|
"watchpoint hit, first time"
|
||||||
}
|
}
|
||||||
-re ".*$prompt $" { fail "missed first watchpoint" ; return }
|
-re ".*$prompt $" { fail "watchpoint hit, first time" ; return }
|
||||||
timeout { fail "run to first watchpoint (timeout)" ; return }
|
timeout { fail "watchpoint hit, first time (timeout)" ; return }
|
||||||
eof { fail "run to first watchpoint (eof)" ; 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.
|
# Continue until the next change, from 0 to 1.
|
||||||
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until the next change, from 1 to 2.
|
# Continue until the next change, from 1 to 2.
|
||||||
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until the next change, from 2 to 3.
|
# Continue until the next change, from 2 to 3.
|
||||||
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until the next change, from 3 to 4.
|
# Continue until the next change, from 3 to 4.
|
||||||
# Note that this one is outside the loop.
|
# Note that this one is outside the loop.
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until we hit the finishing marker function.
|
# Continue until we hit the finishing marker function.
|
||||||
# Make sure we hit no more watchpoints.
|
# Make sure we hit no more watchpoints.
|
||||||
|
|
||||||
# This used to fail for a29k-amd-udi (PR 2421), but has been fixed.
|
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \
|
||||||
send "cont\n"
|
"continue to marker2"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Disable the watchpoint so we run at full speed until we exit.
|
# Disable the watchpoint so we run at full speed until we exit.
|
||||||
|
|
||||||
send "disable 3\n"
|
send "disable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "disable 3\r\n$prompt $" { pass "watchpoint disabled" }
|
-re "^disable 3\r\n$prompt $" { pass "watchpoint disabled" }
|
||||||
-re ".*$prompt $" { fail "watchpoint not disabled" ; return }
|
-re ".*$prompt $" { fail "watchpoint disabled" ; return }
|
||||||
timeout { fail "watchpoint not disabled (timeout)" ; return }
|
timeout { fail "watchpoint disabled (timeout)" ; return }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run until process exits.
|
# Run until process exits.
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*Program exited normally.*" \
|
||||||
expect {
|
"continue to exit in test_simple_watchpoint"
|
||||||
-re "Continuing.*Program exited normally.*$prompt $" { }
|
|
||||||
-re ".*$prompt $" { fail "watchpoints not removed" ; return }
|
|
||||||
timeout { fail "looking for process exit (timeout)" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test disabling watchpoints.
|
# Test disabling watchpoints.
|
||||||
|
@ -274,105 +248,81 @@ proc test_disabling_watchpoints {} {
|
||||||
|
|
||||||
send "disable 3\n"
|
send "disable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "disable 3\r\n$prompt $" { }
|
-re "^disable 3\r\n$prompt $" {
|
||||||
-re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
|
pass "disable watchpoint in test_disabling_watchpoints"
|
||||||
timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
|
}
|
||||||
|
-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.
|
# Run until we get to the first marker function.
|
||||||
|
|
||||||
send "run\n"
|
gdb_run_cmd
|
||||||
expect {
|
expect {
|
||||||
-re "The program .* has been started already.* \(y or n\) $" {
|
-re "Breakpoint 1, marker1 .*$prompt $" {
|
||||||
send "y\n"
|
pass "run to marker1 in test_disabling_watchpoints"
|
||||||
exp_continue
|
}
|
||||||
|
-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.
|
# After reaching the marker function, enable the watchpoint.
|
||||||
|
|
||||||
send "enable 3\n"
|
send "enable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "enable 3\r\n$prompt $" { pass "watchpoint enabled" }
|
-re "^enable 3\r\n$prompt $" { pass "watchpoint enabled" }
|
||||||
-re ".*$prompt $" { fail "watchpoint not enabled" ; return }
|
-re ".*$prompt $" { fail "watchpoint enabled" ; return }
|
||||||
timeout { fail "watchpoint not enabled (timeout)" ; return }
|
timeout { fail "watchpoint enabled (timeout)" ; return }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Continue until the first change, from -1 to 0
|
# Continue until the first change, from -1 to 0
|
||||||
# Don't check the old value, because on VxWorks the variable value
|
# Don't check the old value, because on VxWorks the variable value
|
||||||
# will not have been reinitialized.
|
# will not have been reinitialized.
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until the next change, from 0 to 1.
|
# Continue until the next change, from 0 to 1.
|
||||||
|
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"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Disable the watchpoint but leave breakpoints
|
# Disable the watchpoint but leave breakpoints
|
||||||
|
|
||||||
send "disable 3\n"
|
send "disable 3\n"
|
||||||
expect {
|
expect {
|
||||||
-re "disable 3\r\n$prompt $" { }
|
-re "^disable 3\r\n$prompt $" {
|
||||||
-re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
|
pass "disable watchpoint #2 in test_disabling_watchpoints"
|
||||||
timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
|
}
|
||||||
|
-re ".*$prompt $" {
|
||||||
|
"disable watchpoint #2 in test_disabling_watchpoints"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
"disable watchpoint #2 in test_disabling_watchpoints (timeout)"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check watchpoint list, looking for the entry that confirms the
|
# Check watchpoint list, looking for the entry that confirms the
|
||||||
# watchpoint is disabled.
|
# watchpoint is disabled.
|
||||||
|
gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table"
|
||||||
send "info watchpoints\n"
|
|
||||||
expect {
|
|
||||||
-re "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*$prompt $" {
|
|
||||||
pass "watchpoint disabled in table"
|
|
||||||
}
|
|
||||||
-re ".*$prompt $" {
|
|
||||||
fail "disabled watchpoint not found in table"
|
|
||||||
}
|
|
||||||
timeout { fail "info watchpoints (timeout)" }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until we hit the finishing marker function.
|
# Continue until we hit the finishing marker function.
|
||||||
# Make sure we hit no more watchpoints.
|
# Make sure we hit no more watchpoints.
|
||||||
|
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
|
||||||
send "cont\n"
|
"disabled watchpoint skipped"
|
||||||
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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*Program exited normally.*" \
|
||||||
expect {
|
"continue to exit in test_disabling_watchpoints"
|
||||||
-re "Continuing.*Program exited normally.*$prompt $" { }
|
|
||||||
-re ".*$prompt $" { fail "watchpoints not removed" ; return }
|
|
||||||
timeout { fail "looking for process exit (timeout)" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test stepping and other mundane operations with watchpoints enabled
|
# 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"
|
gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2"
|
||||||
|
|
||||||
# Well, let's not be too mundane. It should be a *bit* of a challenge
|
# 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 "break func2 if 0" "Breakpoint.*at.*"
|
||||||
gdb_test "p \\\$func2_breakpoint_number = \\\$bpnum" "="
|
gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*"
|
||||||
|
|
||||||
# The HPPA has a problem here.
|
# The HPPA has a problem here if it's not using hardware watchpoints
|
||||||
if [ istarget "hppa*-*-*" ] then {
|
if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then {
|
||||||
# Don't actually try doing the call, if we do we can't continue.
|
# Don't actually try doing the call, if we do we can't continue.
|
||||||
setup_xfail "*-*-*"
|
setup_xfail "*-*-*"
|
||||||
fail "calling function with watchpoint enabled"
|
fail "calling function with watchpoint enabled"
|
||||||
|
@ -407,6 +357,7 @@ proc test_stepping {} {
|
||||||
clear_xfail "alpha-*-*"
|
clear_xfail "alpha-*-*"
|
||||||
clear_xfail "mips*-*-*"
|
clear_xfail "mips*-*-*"
|
||||||
clear_xfail "sparc-*-*"
|
clear_xfail "sparc-*-*"
|
||||||
|
clear_xfail "hppa*-*-*bsd*"
|
||||||
gdb_test "p func1 ()" "= 73" \
|
gdb_test "p func1 ()" "= 73" \
|
||||||
"calling function with watchpoint enabled"
|
"calling function with watchpoint enabled"
|
||||||
}
|
}
|
||||||
|
@ -418,17 +369,18 @@ proc test_stepping {} {
|
||||||
# the alpha and might be caused by stack adjustment instructions
|
# the alpha and might be caused by stack adjustment instructions
|
||||||
# on other targets. In this case we will step once more.
|
# on other targets. In this case we will step once more.
|
||||||
#
|
#
|
||||||
|
|
||||||
send "finish\n"
|
send "finish\n"
|
||||||
expect {
|
expect {
|
||||||
-re "Run.*exit from.*marker1.*main.* at" { }
|
-re "Run.*exit from.*marker1.*main.* at" { }
|
||||||
default { fail "finish from marker1" ; return }
|
default { fail "finish from marker1" ; return }
|
||||||
}
|
}
|
||||||
expect {
|
expect {
|
||||||
-re "marker1 \[)(\]+;.*$prompt $" {
|
-re "marker1 \\(\\);.*$prompt $" {
|
||||||
send "step\n"
|
send "step\n"
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
-re "func1 \[)(\]+;.*$prompt $" {
|
-re "func1 \\(\\);.*$prompt $" {
|
||||||
pass "finish from marker1"
|
pass "finish from marker1"
|
||||||
}
|
}
|
||||||
-re ".*$prompt $" {
|
-re ".*$prompt $" {
|
||||||
|
@ -437,7 +389,7 @@ proc test_stepping {} {
|
||||||
default { fail "finish from marker1" ; return }
|
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
|
# Now test that "until" works. It's a bit tricky to test
|
||||||
# "until", because compilers don't always arrange the code
|
# "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
|
# stepping through the loop once, and the debugger should not
|
||||||
# stop for any of the remaining iterations.
|
# stop for any of the remaining iterations.
|
||||||
|
|
||||||
gdb_test "until" "ival1 = count"
|
gdb_test "until" "ival1 = count.*" "until to ival1 assignment"
|
||||||
gdb_test "until" "ival3 = count"
|
gdb_test "until" "ival3 = count.*" "until to ival3 assignment"
|
||||||
send "until\n"
|
send "until\n"
|
||||||
expect {
|
expect {
|
||||||
-re "(for \[(\]+count = 0|\}).*$prompt $" {
|
-re "(for \\(count = 0|\}).*$prompt $" {
|
||||||
gdb_test "until" "ival1 = count; /. Outside loop ./"
|
gdb_test "until" "ival1 = count; /. Outside loop ./" \
|
||||||
|
"until out of loop"
|
||||||
}
|
}
|
||||||
-re "ival1 = count; /. Outside loop ./.*$prompt $" {
|
-re "ival1 = count; /. Outside loop ./.*$prompt $" {
|
||||||
pass "until out of loop"
|
pass "until out of loop"
|
||||||
|
@ -464,7 +417,7 @@ proc test_stepping {} {
|
||||||
default { fail "until out of loop" ; return }
|
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 y 0
|
||||||
set testname "Watch buffer passed to read syscall"
|
set testname "Watch buffer passed to read syscall"
|
||||||
if [runto marker2] then {
|
if [runto marker2] then {
|
||||||
gdb_test "watch buf\\\[0\\\]" ".*\[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"
|
gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]"
|
||||||
gdb_test "watch buf\\\[2\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
|
gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]"
|
||||||
gdb_test "watch buf\\\[3\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
|
gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]"
|
||||||
gdb_test "watch buf\\\[4\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
|
gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]"
|
||||||
gdb_test "break marker4" ".*Breakpoint.*"
|
gdb_test "break marker4" ".*Breakpoint.*"
|
||||||
|
|
||||||
send "set doread = 1\n"
|
gdb_test "set doread = 1" ""
|
||||||
expect {
|
|
||||||
-re ".*$prompt $" { }
|
|
||||||
timeout { fail "set doread" ; return }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Sometimes our string never gets to GDB?!? dejagnu bug? Whatever
|
# Sometimes our string never gets to GDB?!? dejagnu bug? Whatever
|
||||||
# the cause we'll set a reasonably short timeout and resend our
|
# 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 "continue\n"
|
||||||
send "123\n"
|
send "123\n"
|
||||||
expect {
|
expect {
|
||||||
-re ".*Watchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\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 ".*Watchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\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 ".*Watchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\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 ".*Watchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\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 $" { }
|
-re ".*$prompt $" { }
|
||||||
timeout {
|
timeout {
|
||||||
set timeout $saved_timeout
|
set timeout $saved_timeout
|
||||||
|
@ -521,62 +470,44 @@ proc test_watchpoint_triggered_in_syscall {} {
|
||||||
expect {
|
expect {
|
||||||
-re ".*= 49.*$prompt $" { set y [expr $y+1] }
|
-re ".*= 49.*$prompt $" { set y [expr $y+1] }
|
||||||
-re ".*= 0" { }
|
-re ".*= 0" { }
|
||||||
default { fail "bogus value in buf[0]" }
|
default { }
|
||||||
timeout { fail "retrieving contents of buf variable (timeout) }
|
timeout { }
|
||||||
}
|
}
|
||||||
send "print buf\[1\]\n"
|
send "print buf\[1\]\n"
|
||||||
expect {
|
expect {
|
||||||
-re ".*= 50.*$prompt $" { set y [expr $y+1] }
|
-re ".*= 50.*$prompt $" { set y [expr $y+1] }
|
||||||
-re ".*= 0" { }
|
-re ".*= 0" { }
|
||||||
default { fail "bogus value in buf[1]" }
|
default { }
|
||||||
timeout { fail "retrieving contents of buf variable (timeout) }
|
timeout { }
|
||||||
}
|
}
|
||||||
send "print buf\[2\]\n"
|
send "print buf\[2\]\n"
|
||||||
expect {
|
expect {
|
||||||
-re ".*= 51.*$prompt $" { set y [expr $y+1] }
|
-re ".*= 51.*$prompt $" { set y [expr $y+1] }
|
||||||
-re ".*= 0" { }
|
-re ".*= 0" { }
|
||||||
default { fail "bogus value in buf[2]" }
|
default { }
|
||||||
timeout { fail "retrieving contents of buf variable (timeout) }
|
timeout { }
|
||||||
}
|
}
|
||||||
send "print buf\[3\]\n"
|
send "print buf\[3\]\n"
|
||||||
expect {
|
expect {
|
||||||
-re ".*= 10.*$prompt $" { set y [expr $y+1] }
|
-re ".*= 10.*$prompt $" { set y [expr $y+1] }
|
||||||
-re ".*= 0" { }
|
-re ".*= 0" { }
|
||||||
default { fail "bogus value in buf[3]" }
|
default { }
|
||||||
timeout { fail "retrieving contents of buf variable (timeout) }
|
timeout { }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Did we find what we were looking for? If not, flunk it.
|
# 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.
|
# Continue until we hit the finishing marker function.
|
||||||
# Make sure we hit no more watchpoints.
|
# 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
|
# Disable everything so we can finish the program at full speed
|
||||||
send "disable\n"
|
gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall"
|
||||||
expect {
|
|
||||||
-re ".*$prompt $" { }
|
|
||||||
timeout { fail "disabling breakpoints (timeout)" }
|
|
||||||
}
|
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*Program exited normally.*" \
|
||||||
expect {
|
"continue to exit in test_watchpoint_triggered_in_syscall"
|
||||||
-re "Continuing.*Program exited normally.*$prompt $" { }
|
|
||||||
-re ".*$prompt $" { fail "watchpoints not removed" ; return }
|
|
||||||
timeout { fail "looking for process exit (timeout)" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,45 +517,23 @@ proc test_watchpoint_triggered_in_syscall {} {
|
||||||
proc test_complex_watchpoint {} {
|
proc test_complex_watchpoint {} {
|
||||||
global prompt
|
global prompt
|
||||||
|
|
||||||
set testname "Test complex watchpoint"
|
|
||||||
if [runto marker4] then {
|
if [runto marker4] then {
|
||||||
gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
|
gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
|
||||||
gdb_test "break marker5" ".*Breakpoint.*"
|
gdb_test "break marker5" ".*Breakpoint.*"
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ptr1->val.*Old value = 1.*New value = 2.*" "Test complex watchpoint"
|
||||||
expect {
|
|
||||||
-re "Continuing.*Watchpoint.*ptr1->val.*Old value = 1.*New value = 2.*$prompt $" { pass $testname }
|
|
||||||
default { fail $testname ; return }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Continue until we hit the marker5 function.
|
# Continue until we hit the marker5 function.
|
||||||
# Make sure we hit no more watchpoints.
|
# Make sure we hit no more watchpoints.
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \
|
||||||
expect {
|
"did not trigger wrong watchpoint"
|
||||||
-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 }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Disable everything so we can finish the program at full speed
|
# Disable everything so we can finish the program at full speed
|
||||||
send "disable\n"
|
gdb_test "disable" "" "disable in test_complex_watchpoint"
|
||||||
expect {
|
|
||||||
-re ".*$prompt $" { }
|
|
||||||
timeout { fail "disabling breakpoints (timeout)" }
|
|
||||||
}
|
|
||||||
|
|
||||||
send "cont\n"
|
gdb_test "cont" "Continuing.*Program exited normally.*" \
|
||||||
expect {
|
"continue to exit in test_complex_watchpoint"
|
||||||
-re "Continuing.*Program exited normally.*$prompt $" { }
|
|
||||||
-re ".*$prompt $" { fail "watchpoints not removed" ; return }
|
|
||||||
timeout { fail "looking for process exit (timeout)" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,12 +566,6 @@ if [initialize] then {
|
||||||
initialize
|
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
|
test_disabling_watchpoints
|
||||||
|
|
||||||
# See above.
|
# See above.
|
||||||
|
@ -685,8 +588,9 @@ if [initialize] then {
|
||||||
initialize
|
initialize
|
||||||
}
|
}
|
||||||
|
|
||||||
# This test hasn't been tested on anything but the PA.
|
# Only enabled for some targets merely because it has not been tested
|
||||||
if [istarget "hppa*-*-*"] then {
|
# elsewhere.
|
||||||
|
if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then {
|
||||||
test_watchpoint_triggered_in_syscall
|
test_watchpoint_triggered_in_syscall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,8 +603,9 @@ if [initialize] then {
|
||||||
initialize
|
initialize
|
||||||
}
|
}
|
||||||
|
|
||||||
# This test hasn't been tested on anything but the PA.
|
# Only enabled for some targets merely because it has not been tested
|
||||||
if [istarget "hppa*-*-*"] then {
|
# elsewhere.
|
||||||
|
if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then {
|
||||||
test_complex_watchpoint
|
test_complex_watchpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,8 +613,3 @@ if [initialize] then {
|
||||||
|
|
||||||
set timeout $timeoutsave
|
set timeout $timeoutsave
|
||||||
}
|
}
|
||||||
|
|
||||||
if [istarget "a29k-*-udi"] then {
|
|
||||||
# FIXME: If PR 2415 is fixed, this is not needed.
|
|
||||||
gdb_target_udi
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue