From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29360 invoked by alias); 18 Dec 2001 10:57:43 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29237 invoked from network); 18 Dec 2001 10:56:24 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 18 Dec 2001 10:56:24 -0000 Received: from there (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with SMTP id CAA08011; Tue, 18 Dec 2001 02:56:17 -0800 (PST) Message-Id: <200112181056.CAA08011@cygnus.com> Content-Type: text/plain; charset="iso-8859-1" From: "Martin M. Hunt" Organization: Red Hat Inc To: Orjan Friberg , gdb-patches@sources.redhat.com Subject: Re: [RFA] new tcp_open Date: Tue, 18 Dec 2001 02:57:00 -0000 X-Mailer: KMail [version 1.3.2] References: <200112031918.LAA18199@cygnus.com> <3C1F1D00.A35E3AF@axis.com> In-Reply-To: <3C1F1D00.A35E3AF@axis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2001-12/txt/msg00437.txt.bz2 On Tuesday 18 December 2001 02:40 am, Orjan Friberg wrote: > "Martin M. Hunt" wrote: > > Problem: Using "target remote" to open a tcp connection to a target > > board doesn't timeout properly if the target isn't running or you mistype > > the name or port number. The tcp_open function tries to connect 15 times, > > each of which can take a couple of minutes to timeout. You can't > > interrupt the connect from the GUI, which is not updated, or from the > > command line with a ^C. > > > > I propose replacing tcp_open with a new function that does a non-blocking > > connect with a maximum timeout of 15 seconds. This is easily > > interruptable by typing ^C or clicking on the stop button. I have tested > > this with Linux, Solaris, and Cygwin. > > In my setup, this patch makes the testsuite run an order of a magnitude > slower (I downgraded only this file from an otherwise updated tree, and > it fixes the problem). My target board runs an unsubmitted port (for > various reasons) of the gdbserver on a Linux 2.4.14 kernel, and my host > is a Linux 2.2.19. I don't see any recent gdbserver changes that should > be related to this change. Anyone else seeing this slowdown? Please give this patch a try and see if it fixes the problem. Index: ser-tcp.c =================================================================== RCS file: /cvs/src/src/gdb/ser-tcp.c,v retrieving revision 1.9 diff -u -p -r1.9 ser-tcp.c --- ser-tcp.c 2001/12/07 17:57:05 1.9 +++ ser-tcp.c 2001/12/18 10:54:31 @@ -165,6 +165,10 @@ tcp_open (struct serial *scb, const char tmp = 0; ioctl (scb->fd, FIONBIO, &tmp); + tmp = 1; + setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, + (char *)&tmp, sizeof (tmp)); + /* If we don't do this, then GDB simply exits when the remote side dies. */ signal (SIGPIPE, SIG_IGN); -- Martin Hunt GDB Engineer Red Hat, Inc.