diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-04-15 12:46:58 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-04-15 12:46:58 +0100 |
commit | 45fd756cafe258b9792b86e1f5df823ec0b848b4 (patch) | |
tree | b5b92571334a99e4481e13a596e5cf9788e4b8f2 /gdb/testsuite/lib | |
parent | 78e9aa70febc3985a2c88dbc0c7a87d214231c3d (diff) | |
download | gdb-45fd756cafe258b9792b86e1f5df823ec0b848b4.zip gdb-45fd756cafe258b9792b86e1f5df823ec0b848b4.tar.gz gdb-45fd756cafe258b9792b86e1f5df823ec0b848b4.tar.bz2 |
Increase timeout in watch-bitfields.exp for software watchpoint
I see the following two timeout fails on pandaboard (arm-linux target),
FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit (timeout)
FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit (timeout)
In this test, more than one watchpoint is used, so the following
watchpoint requests fall back to software watchpoint, so that GDB
will single step all the way and it is very slow.
This patch is to copy the fix from
[PATCH] GDB/testsuite: Correct gdb.base/watchpoint-solib.exp timeout tweak
https://sourceware.org/ml/gdb-patches/2014-07/msg00716.html
I find the left-over of this patch review is to factor out code into
a procedure, so I do that in this patch.
Re-run tests watch-bitfields.exp, watchpoint-solib.exp, sigall-reverse.exp,
and until-precsave.exp on pandaboard, no regression.
gdb/testsuite:
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.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f1616e3..7d8720b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1894,6 +1894,54 @@ proc with_target_charset { target_charset body } { } } +# 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 { @@ -3266,26 +3314,10 @@ proc gdb_expect { args } { # 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 |