From: Bob Rossi <bob@brasko.net>
To: Andrew Cagney <cagney@gnu.org>, gdb-patches@sources.redhat.com
Subject: Re: mi tty commands
Date: Fri, 11 Mar 2005 02:26:00 -0000 [thread overview]
Message-ID: <20050311022644.GA15563@white> (raw)
In-Reply-To: <20050302025219.GA29948@white>
Ping
Bob Rossi
On Tue, Mar 01, 2005 at 09:52:19PM -0500, Bob Rossi wrote:
> Ping
>
> Hi Andrew,
>
> I know this patch hasn't been posted long, but I was hoping to get a
> speedy review. I've got another patch that depends on this, and once
> that is in, another patch that depends on that. Maybe more.
>
> Thanks,
> Bob Rossi
>
> On Mon, Feb 28, 2005 at 11:20:03AM -0500, Bob Rossi wrote:
> > On Fri, Feb 25, 2005 at 04:22:02PM -0500, Daniel Jacobowitz wrote:
> > > On Fri, Feb 25, 2005 at 04:19:11PM -0500, Bob Rossi wrote:
> > > > On Fri, Feb 25, 2005 at 10:32:21PM +0200, Eli Zaretskii wrote:
> > > > > > Date: Thu, 24 Feb 2005 15:35:35 -0500
> > > > > > From: Bob Rossi <bob@brasko.net>
> > > > > >
> > > > > > What doco needs to be done for this?
> > > > >
> > > > > Any new MI commands should be documented in gdb.texinfo.
> > > >
> > > > Is everyone happy with these commands? or should I remove them, and make
> > > > an interface to the set/show CLI commands (which would access the same
> > > > data)?
> > >
> > > No, I think individual MI commands is a much better idea. There's too
> > > much historical baggage in the CLI's set/show, and MI is not supposed
> > > to depend on the CLI.
> >
> > OK, here is an updated patch with doco.
> >
> > Index: src/gdb/ChangeLog
> > + * fork-child.c (fork-inferior): Use accessor function for
> > + inferior_io_terminal
> > + * infcmd.c (inferior_io_terminal): make static
> > + (set_inferior_io_terminal): Add accessor definition
> > + (get_inferior_io_terminal): Add accessor definition
> > + (tty_command): Use accessor function
> > + (_initialize_infcmd): Add inferior_tty setshow variable
> > + * inferior.h (set_inferior_io_terminal): Add accessor declaration
> > + (get_inferior_io_terminal): Add accessor declaration
> > + * nto-procfs (procfs_create_inferior): Use accessor function
> > + * win32-nat.c (child_create_inferior): Use accessor function
> > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): Add MI definition
> > + (mi_cmd_inferior_tty_set): Add MI definition
> > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set/inferior-tty-show
> > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype
> > + (mi_cmd_inferior_tty_show): Add prototype
> >
> > Index: src/gdb/doc/ChangeLog
> > +2005-02-28 Bob Rossi <bob@brasko.net>
> > +
> > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add '-inferior-tty-set'
> > + (GDB/MI Miscellaneous Commands): Add '-inferior-tty-show'
> >
> > Index: src/gdb/testsuite/ChangeLog
> > +2005-02-28 Bob Rossi <bob@brasko.net>
> > +
> > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > + command
> >
> >
> > Thanks,
> > Bob Rossi
> >
> > Index: src/gdb/fork-child.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/fork-child.c,v
> > retrieving revision 1.25
> > diff -w -u -r1.25 fork-child.c
> > --- src/gdb/fork-child.c 11 Feb 2005 18:13:49 -0000 1.25
> > +++ src/gdb/fork-child.c 28 Feb 2005 16:11:43 -0000
> > @@ -137,6 +137,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. */
> > @@ -260,7 +261,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
> > Index: src/gdb/infcmd.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/infcmd.c,v
> > retrieving revision 1.134
> > diff -w -u -r1.134 infcmd.c
> > --- src/gdb/infcmd.c 21 Feb 2005 03:25:56 -0000 1.134
> > +++ src/gdb/infcmd.c 28 Feb 2005 16:11:44 -0000
> > @@ -135,7 +135,7 @@
> >
> > /* File name for default use for standard in/out in the inferior. */
> >
> > -char *inferior_io_terminal;
> > +static char *inferior_io_terminal;
> >
> > /* Pid of our debugged inferior, or 0 if no inferior now.
> > Since various parts of infrun.c test this to see whether there is a program
> > @@ -202,6 +202,24 @@
> > \f
> > /* Accessor routines. */
> >
> > +void
> > +set_inferior_io_terminal (char *terminal_name)
> > +{
> > + if (inferior_io_terminal)
> > + xfree ( inferior_io_terminal );
> > +
> > + if (!terminal_name)
> > + inferior_io_terminal = NULL;
> > + else
> > + inferior_io_terminal = savestring (terminal_name, strlen (terminal_name));
> > +}
> > +
> > +const char *
> > +get_inferior_io_terminal (void)
> > +{
> > + return inferior_io_terminal;
> > +}
> > +
> > char *
> > get_inferior_args (void)
> > {
> > @@ -375,7 +393,7 @@
> > if (file == 0)
> > error_no_arg (_("terminal name for running target process"));
> >
> > - inferior_io_terminal = savestring (file, strlen (file));
> > + set_inferior_io_terminal (file);
> > }
> >
> > /* Kill the inferior if already running. This function is designed
> > @@ -1982,6 +2000,14 @@
> > _("Set terminal for future runs of program being debugged."));
> > set_cmd_completer (c, filename_completer);
> >
> > + /* 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_setshow_optional_filename_cmd ("args", class_run,
> > &inferior_args, _("\
> > Set argument list to give program being debugged when it is started."), _("\
> > Index: src/gdb/inferior.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/inferior.h,v
> > retrieving revision 1.69
> > diff -w -u -r1.69 inferior.h
> > --- src/gdb/inferior.h 12 Sep 2004 15:05:05 -0000 1.69
> > +++ src/gdb/inferior.h 28 Feb 2005 16:11:44 -0000
> > @@ -102,9 +102,10 @@
> >
> > extern void clear_sigio_trap (void);
> >
> > -/* File name for default use for standard in/out in the inferior. */
> > +/* Set/Get name for default use for standard in/out in the inferior. */
> >
> > -extern char *inferior_io_terminal;
> > +extern void set_inferior_io_terminal (char *terminal_name);
> > +extern const char *get_inferior_io_terminal (void);
> >
> > /* Collected pid, tid, etc. of the debugged inferior. When there's
> > no inferior, PIDGET (inferior_ptid) will be 0. */
> > Index: src/gdb/nto-procfs.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/nto-procfs.c,v
> > retrieving revision 1.13
> > diff -w -u -r1.13 nto-procfs.c
> > --- src/gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
> > +++ src/gdb/nto-procfs.c 28 Feb 2005 16:11:45 -0000
> > @@ -984,6 +984,7 @@
> > char *in = "", *out = "", *err = "";
> > int fd, fds[3];
> > sigset_t set;
> > + const char *inferior_io_terminal = get_inferior_io_terminal();
> >
> > argv = xmalloc (((strlen (allargs) + 1) / (unsigned) 2 + 2) *
> > sizeof (*argv));
> > @@ -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])
> > Index: src/gdb/win32-nat.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/win32-nat.c,v
> > retrieving revision 1.108
> > diff -w -u -r1.108 win32-nat.c
> > --- src/gdb/win32-nat.c 18 Feb 2005 15:25:31 -0000 1.108
> > +++ src/gdb/win32-nat.c 28 Feb 2005 16:11:46 -0000
> > @@ -1725,6 +1725,7 @@
> > const char *sh;
> > int tty;
> > int ostdin, ostdout, ostderr;
> > + const char *inferior_io_terminal = get_inferior_io_terminal();
> >
> > if (!exec_file)
> > error (_("No executable specified, use `target exec'."));
> > Index: src/gdb/doc/gdb.texinfo
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> > retrieving revision 1.232
> > diff -w -u -r1.232 gdb.texinfo
> > --- src/gdb/doc/gdb.texinfo 9 Feb 2005 19:06:08 -0000 1.232
> > +++ src/gdb/doc/gdb.texinfo 28 Feb 2005 16:12:01 -0000
> > @@ -17525,6 +17525,57 @@
> > (@value{GDBP})
> > @end smallexample
> >
> > +@subheading The @code{-inferior-tty-set} Command
> > +@findex -inferior-tty-set
> > +
> > +@subheading Synopsis
> > +
> > +@smallexample
> > +-inferior-tty-set /dev/pts/1
> > +@end smallexample
> > +
> > +Set terminal for future runs of program being debugged.
> > +
> > +@subheading @value{GDBN} Command
> > +
> > +The corresponding @value{GDBN} command is @samp{set inferior_tty /dev/pts/1}.
> > +
> > +@subheading Example
> > +
> > +@smallexample
> > +(@value{GDBP})
> > +-inferior-tty-set /dev/pts/1
> > +^done
> > +(@value{GDBP})
> > +@end smallexample
> > +
> > +@subheading The @code{-inferior-tty-show} Command
> > +@findex -inferior-tty-show
> > +
> > +@subheading Synopsis
> > +
> > +@smallexample
> > +-inferior-tty-show
> > +@end smallexample
> > +
> > +Show terminal for future runs of program being debugged.
> > +
> > +@subheading @value{GDBN} Command
> > +
> > +The corresponding @value{GDBN} command is @samp{show inferior_tty /dev/pts/1}.
> > +
> > +@subheading Example
> > +
> > +@smallexample
> > +(@value{GDBP})
> > +-inferior-tty-set /dev/pts/1
> > +^done
> > +(@value{GDBP})
> > +-inferior-tty-show
> > +^done,inferior_tty_terminal="/dev/pts/1"
> > +(@value{GDBP})
> > +@end smallexample
> > +
> > @ignore
> > @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > @node GDB/MI Kod Commands
> > Index: src/gdb/mi/mi-cmd-env.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/mi/mi-cmd-env.c,v
> > retrieving revision 1.8
> > diff -w -u -r1.8 mi-cmd-env.c
> > --- src/gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
> > +++ src/gdb/mi/mi-cmd-env.c 28 Feb 2005 16:12:01 -0000
> > @@ -244,6 +244,30 @@
> > return MI_CMD_DONE;
> > }
> >
> > +/* Set the inferior terminal device name */
> > +enum mi_cmd_result
> > +mi_cmd_inferior_tty_set(char *command, char **argv, int argc)
> > +{
> > + set_inferior_io_terminal (argv[0]);
> > +
> > + return MI_CMD_DONE;
> > +}
> > +
> > +/* Print the inferior terminal device name */
> > +enum mi_cmd_result
> > +mi_cmd_inferior_tty_show(char *command, char **argv, int argc)
> > +{
> > + const char *inferior_io_terminal = get_inferior_io_terminal ();
> > +
> > + if ( !mi_valid_noargs("mi_cmd_inferior_tty_show", argc, argv) )
> > + error (_("mi_cmd_inferior_tty_show: Usage: No args"));
> > +
> > + if (inferior_io_terminal)
> > + ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal);
> > +
> > + return MI_CMD_DONE;
> > +}
> > +
> > void
> > _initialize_mi_cmd_env (void)
> > {
> > Index: src/gdb/mi/mi-cmds.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
> > retrieving revision 1.16
> > diff -w -u -r1.16 mi-cmds.c
> > --- src/gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
> > +++ src/gdb/mi/mi-cmds.c 28 Feb 2005 16:12:01 -0000
> > @@ -153,6 +153,8 @@
> > { "trace-save", { NULL, 0 }, NULL, NULL },
> > { "trace-start", { NULL, 0 }, NULL, NULL },
> > { "trace-stop", { NULL, 0 }, NULL, NULL },
> > + { "inferior-tty-set", { NULL, 0 }, NULL, mi_cmd_inferior_tty_set },
> > + { "inferior-tty-show", { NULL, 0 }, NULL, mi_cmd_inferior_tty_show },
> > { "var-assign", { NULL, 0 }, 0, mi_cmd_var_assign},
> > { "var-create", { NULL, 0 }, 0, mi_cmd_var_create},
> > { "var-delete", { NULL, 0 }, 0, mi_cmd_var_delete},
> > Index: src/gdb/mi/mi-cmds.h
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
> > retrieving revision 1.15
> > diff -w -u -r1.15 mi-cmds.h
> > --- src/gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
> > +++ src/gdb/mi/mi-cmds.h 28 Feb 2005 16:12:01 -0000
> > @@ -96,6 +96,8 @@
> > extern mi_cmd_args_ftype mi_cmd_target_select;
> > extern mi_cmd_argv_ftype mi_cmd_thread_list_ids;
> > extern mi_cmd_argv_ftype mi_cmd_thread_select;
> > +extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set;
> > +extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show;
> > extern mi_cmd_argv_ftype mi_cmd_var_assign;
> > extern mi_cmd_argv_ftype mi_cmd_var_create;
> > extern mi_cmd_argv_ftype mi_cmd_var_delete;
> > Index: src/gdb/testsuite/gdb.mi/mi-basics.exp
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
> > retrieving revision 1.9
> > diff -w -u -r1.9 mi-basics.exp
> > --- src/gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
> > +++ src/gdb/testsuite/gdb.mi/mi-basics.exp 28 Feb 2005 16:12:09 -0000
> > @@ -236,12 +236,41 @@
> >
> > }
> >
> > +proc test_setshow_inferior_tty {} {
> > + global mi_gdb_prompt
> > +
> > + # test that the commands,
> > + # -inferior-tty-set
> > + # -inferior-tth-show
> > +
> > + mi_gdb_test "301-inferior-tty-show" \
> > + "301\\\^done" \
> > + "initial tty is empty"
> > +
> > + mi_gdb_test "302-inferior-tty-set /dev/pts/1" \
> > + "302\\\^done" \
> > + "set tty to /dev/pts/1"
> > +
> > + mi_gdb_test "303-inferior-tty-show" \
> > + "303\\\^done,inferior_tty_terminal=\"/dev/pts/1\"" \
> > + "tty was set correctly"
> > +
> > + mi_gdb_test "304-inferior-tty-set" \
> > + "304\\\^done" \
> > + "set tty to the empty string"
> > +
> > + mi_gdb_test "305-inferior-tty-show" \
> > + "305\\\^done" \
> > + "final tty is empty"
> > +}
> > +
> > if [test_mi_interpreter_selection] {
> > test_exec_and_symbol_mi_operatons
> > test_breakpoints_deletion
> > test_dir_specification
> > test_cwd_specification
> > test_path_specification
> > + test_setshow_inferior_tty
> > }
> >
> > mi_gdb_exit
next prev parent reply other threads:[~2005-03-11 2:26 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-24 20:49 Bob Rossi
2005-02-26 4:33 ` Eli Zaretskii
2005-02-26 6:07 ` Bob Rossi
2005-02-26 8:25 ` Daniel Jacobowitz
2005-02-28 20:28 ` Bob Rossi
2005-03-02 2:52 ` Bob Rossi
2005-03-11 2:26 ` Bob Rossi [this message]
2005-05-23 3:13 ` Bob Rossi
2005-05-28 23:49 ` Daniel Jacobowitz
2005-05-29 8:37 ` Eli Zaretskii
2005-05-29 16:22 ` Daniel Jacobowitz
2005-05-29 18:10 ` Eli Zaretskii
2005-05-29 19:05 ` Daniel Jacobowitz
2005-05-30 15:48 ` Bob Rossi
2005-06-01 0:14 ` Bob Rossi
2005-06-01 4:00 ` Eli Zaretskii
2005-06-01 13:07 ` Bob Rossi
2005-06-01 17:42 ` Bob Rossi
2005-06-01 20:25 ` Eli Zaretskii
2005-06-02 22:17 ` Bob Rossi
2005-06-03 6:48 ` Eli Zaretskii
2005-06-03 17:32 ` Bob Rossi
2005-06-10 2:28 ` Bob Rossi
2005-06-10 6:36 ` Eli Zaretskii
2005-06-10 11:04 ` Bob Rossi
2005-06-13 3:07 ` Daniel Jacobowitz
2005-06-13 6:09 ` Eli Zaretskii
2005-06-17 21:08 ` Bob Rossi
2005-06-17 21:14 ` Daniel Jacobowitz
2005-06-18 8:27 ` Eli Zaretskii
2005-06-18 12:29 ` Bob Rossi
2005-06-26 13:43 ` Bob Rossi
2005-07-03 18:43 ` Daniel Jacobowitz
2005-07-06 14:54 ` Bob Rossi
2005-07-10 21:08 ` Mark Kettenis
2005-07-10 21:32 ` Bob Rossi
2005-07-11 15:52 ` Bob Rossi
2005-07-11 18:41 ` Mark Kettenis
2005-07-11 20:00 ` Bob Rossi
2005-07-11 20:01 ` Daniel Jacobowitz
2005-07-11 20:44 ` Bob Rossi
2005-07-11 20:55 ` Mark Kettenis
2005-07-11 21:26 ` Bob Rossi
2005-07-12 20:56 ` Mark Kettenis
2005-07-14 14:51 ` Bob Rossi
2005-06-01 20:12 ` Eli Zaretskii
2005-06-01 20:43 ` Bob Rossi
2005-06-02 3:48 ` Eli Zaretskii
2005-05-30 15:48 ` Bob Rossi
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=20050311022644.GA15563@white \
--to=bob@brasko.net \
--cc=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
/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