From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9790 invoked by alias); 13 Jun 2005 03:07:38 -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 9110 invoked by uid 22791); 13 Jun 2005 03:07:33 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 13 Jun 2005 03:07:33 +0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1DhfIS-0006Qd-8r for gdb-patches@sources.redhat.com; Sun, 12 Jun 2005 23:07:32 -0400 Date: Mon, 13 Jun 2005 03:07:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: mi tty commands Message-ID: <20050613030732.GE9288@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20050522210040.GB9231@white> <20050528230855.GE22435@nevyn.them.org> <20050529205435.GA11243@white> <20050601001440.GB15414@white> <20050601130653.GA17103@white> <20050601174149.GA17309@white> <20050602221644.GA21263@white> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050602221644.GA21263@white> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-06/txt/msg00140.txt.bz2 On Thu, Jun 02, 2005 at 06:16:44PM -0400, Bob Rossi wrote: > Index: src/gdb/fork-child.c > =================================================================== > RCS file: /cvs/src/src/gdb/fork-child.c,v > retrieving revision 1.26 > diff -w -u -r1.26 fork-child.c > --- src/gdb/fork-child.c 12 May 2005 20:21:17 -0000 1.26 > +++ src/gdb/fork-child.c 2 Jun 2005 22:12:31 -0000 > @@ -138,6 +138,7 @@ > char **save_our_env; > int shell = 0; > static char **argv; > + const char *inferior_io_terminal = get_inferior_io_terminal (); > > /* If no exec file handed to us, get it from the exec-file command > -- with a good, common error message if none is specified. */ > @@ -261,7 +262,7 @@ > > /* Tell the terminal handling subsystem what tty we plan to run on; > it will just record the information for later. */ > - new_tty_prefork (inferior_io_terminal); > + new_tty_prefork ((char *)inferior_io_terminal); > > /* It is generally good practice to flush any possible pending stdio > output prior to doing a fork, to avoid the possibility of both Uggh! That's a nasty cast. It made me go look at the code behind this. inferior_thisrun_terminal can now be const; so can the argument to new_tty_prefork. Then you can lose the nasty cast. The code could be cleaned up further, but that's for another day. > +void > +set_inferior_io_terminal (char *terminal_name) This argument can be const too. > - c = add_com ("tty", class_run, tty_command, > - _("Set terminal for future runs of program being debugged.")); > + /* add the filename of the terminal connected to inferior I/O */ > + add_setshow_string_noescape_cmd ("inferior-tty", class_run, > + &inferior_io_terminal, _("\ > +Set terminal for future runs of program being debugged."), _("\ > +Show terminal for future runs of program being debugged."), _("\ > +Usage: set inferior-tty /dev/pts/1"), NULL, NULL, &setlist, &showlist); > set_cmd_completer (c, filename_completer); > + add_com_alias ("tty", "set inferior-tty", class_alias, 0); This seems nice. I was thinking of replacing "tty" with "set tty" instead of "set inferior-tty", but I don't have a strong preference one way or the other. > @@ -1010,11 +1011,11 @@ > if (inferior_io_terminal) > { > if (!in[0]) > - in = inferior_io_terminal; > + in = (char*)inferior_io_terminal; > if (!out[0]) > - out = inferior_io_terminal; > + out = (char*)inferior_io_terminal; > if (!err[0]) > - err = inferior_io_terminal; > + err = (char*)inferior_io_terminal; > } > > if (in[0]) Can you change the types of in/out/err instead? Casting away const is bad mojo. > @@ -2088,7 +2088,24 @@ > > When you use the @code{tty} command or redirect input in the @code{run} > command, only the input @emph{for your program} is affected. The input > -for @value{GDBN} still comes from your terminal. > +for @value{GDBN} still comes from your terminal. @code{tty} is an alias > +for @code{set inferior-tty}. > + > +@cindex inferior tty > +@cindex set inferior controlling terminal > +You can use the @code{show inferior-tty} command to tell @value{GDBN} to > +display the name of the terminal that will be used for future runs of your > +program. If we're going to make "tty" an alias for "set inferior-tty", should we update the documentation to refer to "set inferior-tty" everywhere, instead of continuing to suggest that users use "tty"? > +/* Set the inferior terminal device name. */ Formatting. > +/* Print the inferior terminal device name */ Ditto. > + # Test that the commands, > + # -inferior-tty-set > + # -inferior-tth-show Typo. -- Daniel Jacobowitz CodeSourcery, LLC