Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Allow board file to specify remotetimeout
Date: Fri, 07 Nov 2014 01:02:00 -0000	[thread overview]
Message-ID: <m3zjc3akn2.fsf@sspiff.org> (raw)

Hi.

I was cross-testing from linux to windows7 with stdio gdbserver,
and ssh was taking longer to connect than the default remotetimeout
of 2 seconds.

This patch adds the ability to specify remotetimeout in the board file.

For reference sake, here's my board file.

---snip---
# To use this file:
# bash$ cd ${build_dir}/gdb
# bash$ make check RUNTESTFLAGS="--target_board=win7"
#
# gdbserver running over ssh.

set REMOTE_HOSTNAME win7
set REMOTE_USERNAME dje
set REMOTE_PORTNUM 22
set REMOTE_TMPDIR /tmp

load_board_description "remote-stdio-gdbserver"

# Path to the gdbserver executable.
unset_board_info gdb_server_prog
set_board_info gdb_server_prog "/usr/bin/gdbserver.exe"

# It takes a few seconds to establish the ssh session.
set_board_info gdb,remotetimeout 15
---snip---

2014-11-06  Doug Evans  <xdje42@gmail.com>

	* README: Document gdb,remotetimeout.
	* lib/gdbserver-support.exp (gdb_target_cmd): Apply remotetimeout if
	specified in board description.
	* lib/mi-support.exp (mi_gdb_target_cmd): Ditto.

diff --git a/gdb/testsuite/README b/gdb/testsuite/README
index 9a5059a..0e4b73c 100644
--- a/gdb/testsuite/README
+++ b/gdb/testsuite/README
@@ -367,6 +367,10 @@ gdb,predefined_tsv
 
   The predefined trace state variables the board has.
 
+gdb,remotetimeout
+
+  The value for gdb's "remotetimeout" parameter, for use with gdbserver.
+
 
 Testsuite Organization
 **********************
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 026a937..b99a594 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -39,6 +39,8 @@
 #	After GDB starts you should check global $gdbserver_gdbport for the
 #	real port used.  It is not useful if $gdbserver_reconnect_p was not set.
 #
+#   set_board_info gdb,remotetimeout
+#	The value for gdb's "remotetimeout" parameter.
 
 #
 # gdb_target_cmd
@@ -47,6 +49,11 @@
 proc gdb_target_cmd { targetname serialport } {
     global gdb_prompt
 
+    if [target_info exists gdb,remotetimeout] {
+	set remotetimeout [target_info gdb,remotetimeout]
+	gdb_test_no_output "set remotetimeout $remotetimeout"
+    }
+
     set serialport_re [string_to_regexp $serialport]
     for {set i 1} {$i <= 3} {incr i} {
 	send_gdb "target $targetname $serialport\n"
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index a7f7aef..0437fa5 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -335,6 +335,19 @@ proc mi_gdb_reinitialize_dir { subdir } {
 proc mi_gdb_target_cmd { targetname serialport } {
     global mi_gdb_prompt
 
+    if [target_info exists gdb,remotetimeout] {
+	set remotetimeout [target_info gdb,remotetimeout]
+	send_gdb "46-gdb-set remotetimeout $remotetimeout\n"
+	gdb_expect 10 {
+	    -re ".*46-gdb-set remotetimeout $remotetimeout\r\n46\\\^done\r\n$mi_gdb_prompt$" {
+		verbose "Setting remotetimeout to $remotetimeout." 2
+	    }
+	    timeout {
+		warning "Couldn't set remotetimeout to $remotetimeout."
+	    }
+	}
+    }
+
     set serialport_re [string_to_regexp $serialport]
     for {set i 1} {$i <= 3} {incr i} {
 	send_gdb "47-target-select $targetname $serialport\n"


             reply	other threads:[~2014-11-07  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  1:02 Doug Evans [this message]
2014-11-07 10:21 ` Pedro Alves
2014-11-07 15:25   ` Doug Evans
2014-11-07 16:47     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3zjc3akn2.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox