gdb: tests: set remotetimeout to gdb_load_timeout for remote targets
Rather than relying on the default remotetimeout value (which might be too small for some slower devices), use the existing gdb_load_timeout config option to set it. This adds two new helpers for getting/setting the remotetimout to keep the new logic simple. Signed-off-by: Jie Zhang <jie.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
5429523ed4
commit
db863c4274
@ -1,3 +1,15 @@
|
||||
2011-06-30 Jie Zhang <jie.zhang@analog.com>
|
||||
Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* config/monitor.exp (get_remotetimeout, set_remotetimeout): New
|
||||
helper functions for getting/setting remotetimeout variable.
|
||||
* lib/gdb.exp (gdb_load): If the target is remote, set
|
||||
$oldremotetimeout to get_remotetimeout, then call set_remotetimeout
|
||||
with $loadtimeout. Set $load_ok to 0 before doing the load.
|
||||
Instead of returning, immediately, set $load_ok to 0. Call
|
||||
set_remotetimeout with $oldremotetimeout, and then return if
|
||||
$load_ok is 1.
|
||||
|
||||
2011-06-30 Andrew Burgess <aburgess@broadcom.com>
|
||||
|
||||
* gdb.python/py-template.exp: Don't run this test if the target
|
||||
|
@ -226,6 +226,12 @@ proc gdb_load { arg } {
|
||||
set loadtimeout 1600
|
||||
}
|
||||
|
||||
if [is_remote target] {
|
||||
set oldremotetimeout [get_remotetimeout]
|
||||
set_remotetimeout $loadtimeout
|
||||
}
|
||||
|
||||
set load_ok 0
|
||||
send_gdb $command;
|
||||
gdb_expect $loadtimeout {
|
||||
-re "\[Ff\]ailed.*$gdb_prompt $" {
|
||||
@ -235,7 +241,7 @@ proc gdb_load { arg } {
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
verbose "Loaded $farg into $GDB\n"
|
||||
return 0;
|
||||
set load_ok 1
|
||||
}
|
||||
timeout {
|
||||
if { $verbose > 1 } {
|
||||
@ -243,6 +249,14 @@ proc gdb_load { arg } {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if [is_remote target] {
|
||||
set_remotetimeout $oldremotetimeout
|
||||
}
|
||||
|
||||
if { $load_ok == 1 } {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
# Make sure we don't have an open connection to the target.
|
||||
|
@ -3606,6 +3606,33 @@ proc get_sizeof { type default } {
|
||||
return [get_integer_valueof "sizeof (${type})" $default]
|
||||
}
|
||||
|
||||
# Get the current value for remotetimeout and return it.
|
||||
proc get_remotetimeout { } {
|
||||
global gdb_prompt
|
||||
global decimal
|
||||
|
||||
gdb_test_multiple "show remotetimeout" "" {
|
||||
-re "Timeout limit to wait for target to respond is ($decimal).*$gdb_prompt $" {
|
||||
return $expect_out(1,string);
|
||||
}
|
||||
}
|
||||
|
||||
# Pick the default that gdb uses
|
||||
warning "Unable to read remotetimeout"
|
||||
return 300
|
||||
}
|
||||
|
||||
# Set the remotetimeout to the specified timeout. Nothing is returned.
|
||||
proc set_remotetimeout { timeout } {
|
||||
global gdb_prompt
|
||||
|
||||
gdb_test_multiple "set remotetimeout $timeout" "" {
|
||||
-re "$gdb_prompt $" {
|
||||
verbose "Set remotetimeout to $timeout\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Log gdb command line and script if requested.
|
||||
if {[info exists TRANSCRIPT]} {
|
||||
rename send_gdb real_send_gdb
|
||||
|
Loading…
x
Reference in New Issue
Block a user