proc selftest_setup { executable function } {
global gdb_prompt
- global timeout
global INTERNAL_GDBFLAGS
# load yourself into the debugger
- # This can take a relatively long time, particularly for testing where
- # the executable is being accessed over a network, or where gdb does not
- # support partial symbols for a particular target and has to load the
- # entire symbol table. Set the timeout to 10 minutes, which should be
- # adequate for most environments (it *has* timed out with 5 min on a
- # SPARCstation SLC under moderate load, so this isn't unreasonable).
- # After gdb is started, 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
- verbose "Timeout is now $timeout seconds" 2
global gdb_file_cmd_debug_info
set gdb_file_cmd_debug_info "unset"
set result [gdb_load $executable]
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
if { $result != 0 } then {
return -1
}
# run yourself
- # It may take a very long time for the inferior gdb to start (lynx),
- # so we bump it back up for the duration of this command.
- set timeout 600
set description "run until breakpoint at $function"
gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
}
-re "vfork: No more processes.*$gdb_prompt $" {
fail "$description (out of virtual memory)"
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
return -1
}
-re ".*$gdb_prompt $" {
fail "$description"
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
return -1
}
}
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
-
return 0
}
gdb_start
set file [remote_download host $GDB_FULLPATH $xgdb]
- set result [selftest_setup $file $function]
- if {$result == 0} then {
- set result [uplevel $body]
+ # When debugging GDB with GDB, some operations can take a relatively long
+ # time, especially if the build is non-optimized. Bump the timeout for the
+ # duration of the test.
+ with_timeout_factor 10 {
+ set result [selftest_setup $file $function]
+ if {$result == 0} then {
+ set result [uplevel $body]
+ }
}
gdb_exit