From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15274 invoked by alias); 8 Jun 2010 17:27:53 -0000 Received: (qmail 15263 invoked by uid 22791); 8 Jun 2010 17:27:52 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jun 2010 17:27:47 +0000 Received: (qmail 12682 invoked from network); 8 Jun 2010 17:27:45 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Jun 2010 17:27:45 -0000 Date: Tue, 08 Jun 2010 17:27:00 -0000 From: Daniel Jacobowitz To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFA] stdio gdbserver connection Message-ID: <20100608172738.GA17570@caradoc.them.org> Mail-Followup-To: Doug Evans , gdb-patches@sourceware.org References: <20100525172715.A9BE38439A@ruffy.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100525172715.A9BE38439A@ruffy.mtv.corp.google.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-06/txt/msg00210.txt.bz2 On Tue, May 25, 2010 at 10:27:15AM -0700, Doug Evans wrote: > Hi. > > This patch lets gdbserver communicate via stdio. > > E.g. > > (gdb) target remote | ssh -T myhost gdbserver stdio hello Silly thing to comment about but... "-" instead to mean stdio? > One outstanding issue is what to do with inferior stdio. > stderr is ok, it'll just get propagated back to gdb which will display it. > But we don't want inferior stdio to interfere with the gdb connection. Send it to a pipe, pass it to GDB over semihosting? > + /* Use stdin as the handle of the connection. > + We only select on reads, for example. */ > + remote_desc = 0; 0 -> STDIN_FILENO? That's what you check for. > Index: gdbserver/server.c > =================================================================== > RCS file: /cvs/src/src/gdb/gdbserver/server.c,v > retrieving revision 1.120 > diff -u -p -r1.120 server.c > --- gdbserver/server.c 3 May 2010 04:02:20 -0000 1.120 > +++ gdbserver/server.c 25 May 2010 16:48:02 -0000 > @@ -2502,11 +2502,17 @@ main (int argc, char *argv[]) > > /* If an exit was requested (using the "monitor exit" command), > terminate now. The only other way to get here is for > - getpkt to fail; close the connection and reopen it at the > + getpkt to fail; if the connection is via stdio terminate now, > + otherwise close the connection and reopen it at the > top of the loop. */ > > - if (exit_requested) > + if (exit_requested > + || remote_connection_is_stdio ()) > { > + if (debug_threads > + && remote_connection_is_stdio ()) > + fprintf (stderr, "Remote side has terminated connection. " > + "Shutting down.\n"); > detach_or_kill_for_exit (); > exit (0); > } This will print the message if exit_requested && remote_connection_is_stdio (); was that intended? > +@smallexample > +(gdb) target remote | ssh -T gdbserver stdio emacs foo.txt > +@end smallexample > + > +The @samp{-T} option to ssh is provided because we don't need a remote pty, > +and we don't want escape-character handling. Host name is missing. Doesn't ssh default to -T if there's a command? I've no complaints about the general feature. A caveat somewhere about running with a terminal might be in order. Apps that write directly to the tty are unfortunately not too uncommon. -- Daniel Jacobowitz CodeSourcery