aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog31
-rw-r--r--gdb/testsuite/config/cpu32bug.exp1
-rw-r--r--gdb/testsuite/config/est.exp1
-rw-r--r--gdb/testsuite/config/hppro.exp4
-rw-r--r--gdb/testsuite/config/monitor.exp111
-rw-r--r--gdb/testsuite/gdb.base/a1-selftest.exp3
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp73
7 files changed, 178 insertions, 46 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 36ba992..bf77410 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,34 @@
+Wed May 10 17:57:35 1995 Stu Grossman (grossman@andros.cygnus.com)
+
+ * config/cpu32bug.exp, config/est.exp, config/hppro.exp,
+ config/rom68k.exp: New tcl glue for the appropriate monitors.
+ These all just end up calling monitor.exp.
+ * config/monitor.exp (gdb_target_monitor): Handle `Connection
+ refused' by retrying. Cleanup some timeout issues.
+ * (gdb_load): Reduce timeout. Cleanup some timeout issues.
+ * lib/gdb.exp (gdb_test gdb_test_exact): Upvar timeout so that
+ callers don't have to set/restore global timeout variable.
+
+ * The following set of changes centralizes management of the global
+ timeout variable. This way, it can be set in one target dependent
+ place instead of dozens of places scattered throughout the test suite.
+ If you need to lengthen a timeout, then you should either set timeout
+ in one of the config/{target}.exp files, or multiply it by a factor.
+ Setting it to an absolute value is always going to lose for some
+ targets.
+ * gdb.base/a1-selftest.exp (test_with_self): Only use local timeout.
+ * gdb.base/callfuncs.exp (do_function_calls): Don't set timeout.
+ * gdb.base/funcargs.exp: Don't set timeout.
+ * gdb.base/list.exp (test_forward_search): Only use local timeout.
+ * gdb.base/printcmds.exp (test_print_string_constants
+ test_print_array_constants): Don't set timeout.
+ * gdb.base/ptype.exp: Don't set timeout.
+ * gdb.base/recurse.exp: Don't set timeout.
+ * gdb.base/return.exp: Don't set timeout.
+ * gdb.base/watchpoint.exp: Don't set timeout.
+ * gdb.c++/classes.exp (do_tests): Don't set timeout.
+ * gdb.c++/virtfunc.exp (test_virtual_calls): Don't set timeout.
+
Wed May 10 16:03:23 1995 Torbjorn Granlund <tege@adder.cygnus.com>
* Makefile.in: Make clean targets work also when SUBDIRS is empty.
diff --git a/gdb/testsuite/config/cpu32bug.exp b/gdb/testsuite/config/cpu32bug.exp
new file mode 100644
index 0000000..1a2f7a9
--- /dev/null
+++ b/gdb/testsuite/config/cpu32bug.exp
@@ -0,0 +1 @@
+load_lib ../config/monitor.exp
diff --git a/gdb/testsuite/config/est.exp b/gdb/testsuite/config/est.exp
new file mode 100644
index 0000000..1a2f7a9
--- /dev/null
+++ b/gdb/testsuite/config/est.exp
@@ -0,0 +1 @@
+load_lib ../config/monitor.exp
diff --git a/gdb/testsuite/config/hppro.exp b/gdb/testsuite/config/hppro.exp
new file mode 100644
index 0000000..d71a398
--- /dev/null
+++ b/gdb/testsuite/config/hppro.exp
@@ -0,0 +1,4 @@
+load_lib ../config/monitor.exp
+
+# Hppro monitor is very slow...
+set timeout 540
diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
new file mode 100644
index 0000000..c977e14
--- /dev/null
+++ b/gdb/testsuite/config/monitor.exp
@@ -0,0 +1,111 @@
+# Test Framework Driver for GDB driving a ROM monitor (via monitor.c).
+# Copyright 1995 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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. */
+
+load_lib gdb.exp
+
+#
+# gdb_version -- extract and print the version number of gdb
+#
+proc gdb_version {} {
+ default_gdb_version
+}
+
+#
+# gdb_target_monitor
+# Set gdb to target the monitor
+#
+proc gdb_target_monitor { } {
+ global prompt
+ global exit_status
+ global targetname
+ global serialport
+ global baud
+
+ set timeout 60
+ for {set i 1} {$i <= 3} {incr i -1} {
+ send "target $targetname $serialport\n"
+ expect {
+ -re "Remote target $targetname connected to.*$prompt $" {
+ verbose "Set target to $targetname"
+ break
+ }
+ -re "Connection refused" {
+ verbose "Connection refused by remote target. Pausing, and trying again."
+ sleep 30
+ continue
+ }
+ timeout {
+ perror "Couldn't set target for $targetname."
+ cleanup
+ exit $exit_status
+ }
+ }
+ }
+}
+
+#
+# gdb_load -- load a file into the debugger.
+# return a -1 if anything goes wrong.
+#
+proc gdb_load { arg } {
+ global verbose
+ global loadpath
+ global loadfile
+ global GDB
+ global prompt
+
+ if [gdb_file_cmd $arg] then { return -1 }
+
+ gdb_target_monitor
+
+ send "load\n"
+ set timeout 600
+ expect {
+ -re ".*$prompt $" {
+ if $verbose>1 then {
+ send_user "Loaded $arg into $GDB\n"
+ }
+ return 1
+ }
+ -re "$prompt $" {
+ if $verbose>1 then {
+ perror "GDB couldn't load."
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ perror "Timed out trying to load $arg."
+ }
+ }
+ }
+}
+
+#
+# gdb_start -- start GDB running.
+#
+proc gdb_start { } {
+ default_gdb_start
+}
+
+#
+# gdb_exit -- exit gdb
+#
+proc gdb_exit { } {
+ catch default_gdb_exit
+}
+
+gdb_start
diff --git a/gdb/testsuite/gdb.base/a1-selftest.exp b/gdb/testsuite/gdb.base/a1-selftest.exp
index 0c9c986..380991d 100644
--- a/gdb/testsuite/gdb.base/a1-selftest.exp
+++ b/gdb/testsuite/gdb.base/a1-selftest.exp
@@ -43,7 +43,6 @@ proc test_with_self {} {
global prompt
global tool
global det_file
- global timeout
global decimal
# load yourself into the debugger
@@ -56,7 +55,6 @@ proc test_with_self {} {
# After gdb is loaded, set the timeout to 30 seconds for the duration
# of this test, and then back to the original value.
- set oldtimeout $timeout
set timeout 600
if {[gdb_load "./x$tool"] <0} then {
return -1
@@ -470,7 +468,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$prompt $"\
gdb_exit
# Set the timeout back to the value it had when we were called.
- set timeout $oldtimeout
# Restart gdb in case next test expects it to be started already.
gdb_start
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 74d98f2..86877de 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -426,8 +426,6 @@ proc test_watchpoint_triggered_in_syscall {} {
global prompt
global timeout
- set saved_timeout $timeout
-
# Run until we get to the first marker function.
set x 0
set y 0
@@ -442,57 +440,55 @@ proc test_watchpoint_triggered_in_syscall {} {
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
- # string again if we timeout.
- set timeout 10
+ # If we send "123\n" before gdb has switched the tty, then it goes
+ # to gdb, not the inferior, and we lose. So that is why we have
+ # watchpoint.c prompt us, so we can wait for that prompt.
send "continue\n"
+ expect {
+ -re "Continuing\\.\r\ntype stuff for buf now:" {
+ pass "continue to read"
+ }
+ default { fail "continue to read"; return }
+ }
send "123\n"
expect {
-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
- send "123\n"
- exp_continue
- }
+ -re ".*$prompt $" { pass "sent 123" }
+ timeout { fail "sent 123" }
}
- # Restore the timeout value.
- set timeout $saved_timeout
-
# Examine the values in buf to see how many watchpoints we
# should have printed.
send "print buf\[0\]\n"
expect {
- -re ".*= 49.*$prompt $" { set y [expr $y+1] }
- -re ".*= 0" { }
- default { }
- timeout { }
+ -re ".*= 49.*$prompt $" { set y [expr $y+1]; pass "print buf\[0\]"}
+ -re ".*= 0.*$prompt $" { pass "print buf\[0\]"}
+ -re ".*$prompt $" { fail "print buf\[0\]"}
+ default { fail "print buf\[0\]"}
}
send "print buf\[1\]\n"
expect {
- -re ".*= 50.*$prompt $" { set y [expr $y+1] }
- -re ".*= 0" { }
- default { }
- timeout { }
+ -re ".*= 50.*$prompt $" { set y [expr $y+1]; pass "print buf\[1\]"}
+ -re ".*= 0.*$prompt $" { pass "print buf\[1\]"}
+ -re ".*$prompt $" { fail "print buf\[1\]"}
+ default { fail "print buf\[1\]"}
}
send "print buf\[2\]\n"
expect {
- -re ".*= 51.*$prompt $" { set y [expr $y+1] }
- -re ".*= 0" { }
- default { }
- timeout { }
+ -re ".*= 51.*$prompt $" { set y [expr $y+1]; pass "print buf\[2\]"}
+ -re ".*= 0.*$prompt $" { pass "print buf\[2\]"}
+ -re ".*$prompt $" { fail "print buf\[2\]"}
+ default { fail "print buf\[2\]"}
}
send "print buf\[3\]\n"
expect {
- -re ".*= 10.*$prompt $" { set y [expr $y+1] }
- -re ".*= 0" { }
- default { }
- timeout { }
+ -re ".*= 10.*$prompt $" { set y [expr $y+1]; pass "print buf\[3\]"}
+ -re ".*= 0.*$prompt $" { pass "print buf\[3\]"}
+ -re ".*$prompt $" { fail "print buf\[3\]" }
+ default { fail "print buf\[3\]" }
}
# Did we find what we were looking for? If not, flunk it.
@@ -546,13 +542,6 @@ gdb_load $objdir/$subdir/$binfile
if [initialize] then {
- # Preserve the old timeout, and set a new one that should be
- # sufficient to step from marker1 to marker2 with watchpoints
- # set anywhere.
-
- set timeoutsave $timeout
- set timeout 60
-
test_simple_watchpoint
# The IDT/sim monitor only has 8 (!) open files, of which it uses
@@ -590,7 +579,9 @@ if [initialize] then {
# Only enabled for some targets merely because it has not been tested
# elsewhere.
- if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then {
+ # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
+ # breakpoint before stopping for the watchpoint. I don't know why.
+ if {[istarget "hppa*-*-*"]} then {
test_watchpoint_triggered_in_syscall
}
@@ -608,8 +599,4 @@ if [initialize] then {
if {[istarget "hppa*-*-*"] || [istarget "sparc*-*-sunos*"]} then {
test_complex_watchpoint
}
-
- # Restore the preserved old timeout value.
-
- set timeout $timeoutsave
}