From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 476 invoked by alias); 29 Jun 2011 23:25:27 -0000 Received: (qmail 448 invoked by uid 22791); 29 Jun 2011 23:25:26 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jun 2011 23:25:10 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id E4DB01B400F; Wed, 29 Jun 2011 23:25:08 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Cc: toolchain-devel@blackfin.uclinux.org, Jie Zhang Subject: [PATCH v3] gdb: tests: set remotetimeout to gdb_load_timeout for remote targets Date: Wed, 29 Jun 2011 23:25:00 -0000 Message-Id: <1309389910-30787-1-git-send-email-vapier@gentoo.org> In-Reply-To: <1308510312-5512-1-git-send-email-vapier@gentoo.org> References: <1308510312-5512-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00481.txt.bz2 From: Jie Zhang 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 Signed-off-by: Mike Frysinger --- v3 - add comments to new helper funcs - use gdb_test_multiple gdb/testsuite/config/monitor.exp | 16 +++++++++++++++- gdb/testsuite/lib/gdb.exp | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletions(-) diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp index be98f1a..ca11600 100644 --- a/gdb/testsuite/config/monitor.exp +++ b/gdb/testsuite/config/monitor.exp @@ -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. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 091b271..de9b4ea 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3626,6 +3626,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 -- 1.7.6