#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
set prms_id 0
set bug_id 0
-set binfile "watchpoint"
-set srcfile $binfile.c
-
-if ![file exists $objdir/$subdir/$binfile] then {
- perror "$objdir/$subdir/$binfile does not exist."
- return 0
+set testfile "watchpoint"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
+ perror "Couldn't compile ${srcfile}"
+ return -1
}
-
# Prepare for watchpoint tests by setting up two breakpoints and one
# watchpoint.
#
send "disable 3\n"
expect {
- -re "disable 3\r\n$prompt $" { pass "disable watchpoint" }
+ -re "disable 3\[\r\n\]+$prompt $" { pass "disable watchpoint" }
-re ".*$prompt $" { fail "disable watchpoint" ; return 0 }
timeout { fail "disable watchpoint (timeout)" ; return 0 }
}
global prompt
global hex
global decimal
+ global noresults
# Ensure that the watchpoint is disabled when we startup.
send "disable 3\n"
expect {
- -re "^disable 3\r\n$prompt $" {
+ -re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint in test_simple_watchpoint"
}
-re ".*$prompt $" {
send "enable 3\n"
expect {
- -re "^enable 3\r\n$prompt $" { pass "enable watchpoint" }
+ -re "^enable 3\[\r\n\]+$prompt $" { pass "enable watchpoint" }
-re ".*$prompt $" { fail "enable watchpoint" ; return }
timeout { fail "enable watchpoint (timeout)" ; return }
}
send "disable 3\n"
expect {
- -re "^disable 3\r\n$prompt $" { pass "watchpoint disabled" }
+ -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.
+ if $noresults==1 then { return }
+
gdb_test "cont" "Continuing.*Program exited normally.*" \
"continue to exit in test_simple_watchpoint"
}
global srcfile
global decimal
global hex
+ global noresults
# Ensure that the watchpoint is disabled when we startup.
send "disable 3\n"
expect {
- -re "^disable 3\r\n$prompt $" {
+ -re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint in test_disabling_watchpoints"
}
-re ".*$prompt $" {
send "enable 3\n"
expect {
- -re "^enable 3\r\n$prompt $" { pass "watchpoint enabled" }
+ -re "^enable 3\[\r\n\]+$prompt $" { pass "watchpoint enabled" }
-re ".*$prompt $" { fail "watchpoint enabled" ; return }
timeout { fail "watchpoint enabled (timeout)" ; return }
}
send "disable 3\n"
expect {
- -re "^disable 3\r\n$prompt $" {
+ -re "^disable 3\[\r\n\]+$prompt $" {
pass "disable watchpoint #2 in test_disabling_watchpoints"
}
-re ".*$prompt $" {
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
"disabled watchpoint skipped"
+ if $noresults==1 then { return }
+
gdb_test "cont" "Continuing.*Program exited normally.*" \
"continue to exit in test_disabling_watchpoints"
}
# Test stepping and other mundane operations with watchpoints enabled
proc test_watchpoint_triggered_in_syscall {} {
global prompt
- global timeout
+ global noinferiorio
+ if $noinferiorio {
+ verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
+ return
+ }
# Run until we get to the first marker function.
set x 0
set y 0
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $objdir/$subdir/$binfile
+gdb_load $binfile
if [initialize] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $objdir/$subdir/$binfile
+ gdb_load $binfile
initialize
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $objdir/$subdir/$binfile
+ gdb_load $binfile
initialize
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $objdir/$subdir/$binfile
+ gdb_load $binfile
initialize
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $objdir/$subdir/$binfile
+ gdb_load $binfile
initialize
}