aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/lib/gdb.exp57
2 files changed, 23 insertions, 40 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0691c46..24fde49 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2014-09-09 Maciej W. Rozycki <macro@codesourcery.com>
+ * lib/gdb.exp (gdb_test_multiple): Remove code to select the
+ timeout, don't pass one down to gdb_expect.
+ (gdb_expect): Rework timeout selection.
+
+2014-09-09 Maciej W. Rozycki <macro@codesourcery.com>
+
* lib/gdbserver-support.exp (gdbserver_start): Throw an error
exception on timeout.
(gdbserver_run): Catch any `gdbserver_spawn' error exceptions.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1019ecd..82242f4 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -792,21 +792,6 @@ proc gdb_test_multiple { command message user_code } {
}
}
- if [target_info exists gdb,timeout] {
- set tmt [target_info gdb,timeout]
- } else {
- if [info exists timeout] {
- set tmt $timeout
- } else {
- global timeout
- if [info exists timeout] {
- set tmt $timeout
- } else {
- set tmt 60
- }
- }
- }
-
set code {
-re ".*A problem internal to GDB has been detected" {
fail "$message (GDB internal error)"
@@ -912,7 +897,7 @@ proc gdb_test_multiple { command message user_code } {
}
set result 0
- set code [catch {gdb_expect $tmt $code} string]
+ set code [catch {gdb_expect $code} string]
if {$code == 1} {
global errorInfo errorCode
return -code error -errorinfo $errorInfo -errorcode $errorCode $string
@@ -3127,35 +3112,27 @@ proc gdb_expect { args } {
set expcode $args
}
+ # A timeout argument takes precedence, otherwise of all the timeouts
+ # select the largest.
+ upvar #0 timeout gtimeout
upvar timeout timeout
-
- if [target_info exists gdb,timeout] {
+ if [info exists atimeout] {
+ set tmt $atimeout
+ } else {
+ set tmt 0
if [info exists timeout] {
- if { $timeout < [target_info gdb,timeout] } {
- set gtimeout [target_info gdb,timeout]
- } else {
- set gtimeout $timeout
- }
- } else {
- set gtimeout [target_info gdb,timeout]
+ set tmt $timeout
}
- }
-
- if ![info exists gtimeout] {
- global timeout
- if [info exists timeout] {
- set gtimeout $timeout
+ if { [info exists gtimeout] && $gtimeout > $tmt } {
+ set tmt $gtimeout
}
- }
-
- if [info exists atimeout] {
- if { ![info exists gtimeout] || $gtimeout < $atimeout } {
- set gtimeout $atimeout
+ if { [target_info exists gdb,timeout]
+ && [target_info gdb,timeout] > $tmt } {
+ set tmt [target_info gdb,timeout]
}
- } else {
- if ![info exists gtimeout] {
+ if { $tmt == 0 } {
# Eeeeew.
- set gtimeout 60
+ set tmt 60
}
}
@@ -3170,7 +3147,7 @@ proc gdb_expect { args } {
}
}
set code [catch \
- {uplevel remote_expect host $gtimeout $expcode} string]
+ {uplevel remote_expect host $tmt $expcode} string]
if [info exists old_val] {
set remote_suppress_flag $old_val
} else {