+2015-04-15 Pedro Alves <palves@redhat.com>
+ Yao Qi <yao.qi@linaro.org>
+
+ * gdb.base/watch-bitfields.exp (test_watch_location): Increase
+ timeout by factor of 4.
+ (test_regular_watch): Likewise.
+ * gdb.base/watchpoint-solib.exp: Use with_timeout_factor.
+ * gdb.reverse/sigall-reverse.exp: Likewise.
+ * gdb.reverse/until-precsave.exp: Likewise.
+ * lib/gdb.exp (with_timeout_factor): New proc.
+ (gdb_expect): Move some code to ...
+ (get_largest_timeout): ... here. New procedure.
+
2015-04-14 Luis Machado <lgustavo@codesourcery.com>
* gdb.base/bp-permanent.exp (test): Reinstate correct test message.
expect_watchpoint "q.e" 0 5
expect_watchpoint "q.a" 1 0
expect_watchpoint "q.e" 5 4
- gdb_continue_to_end
+
+ # It'll execute a large amount of code with software watchpoint
+ # enabled, which means GDB will single stepping all the way
+ # through til the inferior exits. Increase the timeout by a
+ # factor of 4.
+ with_timeout_factor 4 {
+ gdb_continue_to_end
+ }
}
}
expect_watchpoint "q.d + q.f + q.g" 3 2
expect_watchpoint "q.d + q.f + q.g" 2 1
expect_watchpoint "q.d + q.f + q.g" 1 0
- gdb_continue_to_end
+
+ # It'll execute a large amount of code with software watchpoint
+ # enabled, which means GDB will single stepping all the way
+ # through til the inferior exits. Increase the timeout by a
+ # factor of 4.
+ with_timeout_factor 4 {
+ gdb_continue_to_end
+ }
}
}
gdb_test "continue" ".*New value = 1.*" "continue to watchpoint hit"
rerun_to_main
-set savedtimeout $timeout
-if { [target_info exists gdb,timeout]
- && $timeout < [target_info gdb,timeout] } {
- set oldtimeout [target_info gdb,timeout]
-} else {
- set oldtimeout $timeout
+with_timeout_factor 30 {
+ gdb_test "continue" ".*Breakpoint 2.*foo.*" "continue to foo again"
}
-set timeout [expr $oldtimeout * 30]
-
-gdb_test "continue" ".*Breakpoint 2.*foo.*" "continue to foo again"
-
-set timeout $savedtimeout
gdb_test "continue" ".*New value = 1.*" "continue to watchpoint hit again"
"get signal TERM"
gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
-set savedtimeout $timeout
-if { [target_info exists gdb,timeout]
- && $timeout < [target_info gdb,timeout] } {
- set oldtimeout [target_info gdb,timeout]
-} else {
- set oldtimeout $timeout
+with_timeout_factor 2 {
+ gdb_test "continue" "\[process \[0-9\]+ .*" "continue to signal exit" \
+ "The next instruction is syscall exit_group.* program...y. or n. " \
+ "yes"
}
-set timeout [expr $oldtimeout * 2]
-gdb_test "continue" "\[process \[0-9\]+ .*" "continue to signal exit" \
- "The next instruction is syscall exit_group.* program...y. or n. " \
- "yes"
-set timeout $savedtimeout
foreach sig [lreverse $signals] {
test_one_sig_reverse $sig
"BP at end of main"
# This can take awhile.
-set savedtimeout $timeout
-if { [target_info exists gdb,timeout]
- && $timeout < [target_info gdb,timeout] } {
- set oldtimeout [target_info gdb,timeout]
-} else {
- set oldtimeout $timeout
+with_timeout_factor 15 {
+ gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main"
}
-set timeout [expr $oldtimeout * 15]
-gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main"
# So can this, against gdbserver, for example.
-set timeout [expr $oldtimeout * 3]
-gdb_test "record save $precsave" \
- "Saved core file $precsave with execution log\." \
- "save process recfile"
-set timeout $savedtimeout
+
+with_timeout_factor 3 {
+ gdb_test "record save $precsave" \
+ "Saved core file $precsave with execution log\." \
+ "save process recfile"
+}
gdb_test "kill" "" "Kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
}
}
+# Select the largest timeout from all the timeouts:
+# - the local "timeout" variable of the scope two levels above,
+# - the global "timeout" variable,
+# - the board variable "gdb,timeout".
+
+proc get_largest_timeout {} {
+ upvar #0 timeout gtimeout
+ upvar 2 timeout timeout
+
+ set tmt 0
+ if [info exists timeout] {
+ set tmt $timeout
+ }
+ if { [info exists gtimeout] && $gtimeout > $tmt } {
+ set tmt $gtimeout
+ }
+ if { [target_info exists gdb,timeout]
+ && [target_info gdb,timeout] > $tmt } {
+ set tmt [target_info gdb,timeout]
+ }
+ if { $tmt == 0 } {
+ # Eeeeew.
+ set tmt 60
+ }
+
+ return $tmt
+}
+
+# Run tests in BODY with timeout increased by factor of FACTOR. When
+# BODY is finished, restore timeout.
+
+proc with_timeout_factor { factor body } {
+ global timeout
+
+ set savedtimeout $timeout
+
+ set timeout [expr [get_largest_timeout] * $factor]
+ set code [catch {uplevel 1 $body} result]
+
+ set timeout $savedtimeout
+ if {$code == 1} {
+ global errorInfo errorCode
+ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
+ } else {
+ return -code $code $result
+ }
+}
+
# Return 1 if _Complex types are supported, otherwise, return 0.
gdb_caching_proc support_complex_tests {
# A timeout argument takes precedence, otherwise of all the timeouts
# select the largest.
- upvar #0 timeout gtimeout
- upvar timeout timeout
if [info exists atimeout] {
set tmt $atimeout
} else {
- set tmt 0
- if [info exists timeout] {
- set tmt $timeout
- }
- if { [info exists gtimeout] && $gtimeout > $tmt } {
- set tmt $gtimeout
- }
- if { [target_info exists gdb,timeout]
- && [target_info gdb,timeout] > $tmt } {
- set tmt [target_info gdb,timeout]
- }
- if { $tmt == 0 } {
- # Eeeeew.
- set tmt 60
- }
+ set tmt [get_largest_timeout]
}
global suppress_flag