Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@codesourcery.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] stdio gdbserver connection
Date: Tue, 08 Jun 2010 17:27:00 -0000	[thread overview]
Message-ID: <20100608172738.GA17570@caradoc.them.org> (raw)
In-Reply-To: <20100525172715.A9BE38439A@ruffy.mtv.corp.google.com>

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


  parent reply	other threads:[~2010-06-08 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 17:43 Doug Evans
2010-06-08 17:17 ` Tom Tromey
2010-06-08 17:27 ` Daniel Jacobowitz [this message]
2010-08-02 23:11   ` Doug Evans

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=20100608172738.GA17570@caradoc.them.org \
    --to=dan@codesourcery.com \
    --cc=dje@google.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