* mi tty commands
@ 2005-02-24 20:49 Bob Rossi
2005-02-26 4:33 ` Eli Zaretskii
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-02-24 20:49 UTC (permalink / raw)
To: gdb-patches
Hi,
Here is the patch for the MI command. The problem is, the deeper I get
into this, the more that needs to be done.
I noticed that if we simply had an MI command that was a "wrapper"
around the CLI "set/show" commands, then this MI command would not need
to exist.
If I've taken the correct approach, please look at the interface below,
(gdb)
-inferior-tty-set bob
^done
(gdb)
-inferior-tty-show
^done,inferior_tty_terminal="bob"
(gdb)
A few points,
- Should MI commands with no arguments make sure that they are called
with none?
- I use argv[0] in -inferior-tty-set to get the parameter, is this OK?
- Is the name of the MI functions OK?
What doco needs to be done for this? And if any, what section would it
go in?
Any comments would be greatly appreciated.
Thanks,
Bob Rossi
* 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
* gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
command
Index: 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
--- gdb/fork-child.c 11 Feb 2005 18:13:49 -0000 1.25
+++ gdb/fork-child.c 24 Feb 2005 20:17:39 -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: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.134
diff -w -u -r1.134 infcmd.c
--- gdb/infcmd.c 21 Feb 2005 03:25:56 -0000 1.134
+++ gdb/infcmd.c 24 Feb 2005 20:17:40 -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: gdb/inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.69
diff -w -u -r1.69 inferior.h
--- gdb/inferior.h 12 Sep 2004 15:05:05 -0000 1.69
+++ gdb/inferior.h 24 Feb 2005 20:17:40 -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: 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
--- gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
+++ gdb/nto-procfs.c 24 Feb 2005 20:17:41 -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: 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
--- gdb/win32-nat.c 18 Feb 2005 15:25:31 -0000 1.108
+++ gdb/win32-nat.c 24 Feb 2005 20:17:42 -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: 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
--- gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
+++ gdb/mi/mi-cmd-env.c 24 Feb 2005 20:17:43 -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: 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
--- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
+++ gdb/mi/mi-cmds.c 24 Feb 2005 20:17:43 -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: 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
--- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
+++ gdb/mi/mi-cmds.h 24 Feb 2005 20:17:43 -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: 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
--- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
+++ gdb/testsuite/gdb.mi/mi-basics.exp 24 Feb 2005 20:17:51 -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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-02-24 20:49 mi tty commands Bob Rossi
@ 2005-02-26 4:33 ` Eli Zaretskii
2005-02-26 6:07 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-02-26 4:33 UTC (permalink / raw)
To: Bob Rossi; +Cc: gdb-patches
> 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.
> And if any, what section would it go in?
There's a special chapter in the manual describing the MI interface.
I think the node "GDB/MI Miscellaneous Commands" would be a good place
for the new command you want to introduce.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-02-26 4:33 ` Eli Zaretskii
@ 2005-02-26 6:07 ` Bob Rossi
2005-02-26 8:25 ` Daniel Jacobowitz
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-02-26 6:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
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)?
> > And if any, what section would it go in?
>
> There's a special chapter in the manual describing the MI interface.
> I think the node "GDB/MI Miscellaneous Commands" would be a good place
> for the new command you want to introduce.
OK, that's what I was wondering, thanks.
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-02-26 6:07 ` Bob Rossi
@ 2005-02-26 8:25 ` Daniel Jacobowitz
2005-02-28 20:28 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-02-26 8:25 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-02-26 8:25 ` Daniel Jacobowitz
@ 2005-02-28 20:28 ` Bob Rossi
2005-03-02 2:52 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-02-28 20:28 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-02-28 20:28 ` Bob Rossi
@ 2005-03-02 2:52 ` Bob Rossi
2005-03-11 2:26 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-03-02 2:52 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-03-02 2:52 ` Bob Rossi
@ 2005-03-11 2:26 ` Bob Rossi
2005-05-23 3:13 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-03-11 2:26 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-03-11 2:26 ` Bob Rossi
@ 2005-05-23 3:13 ` Bob Rossi
2005-05-28 23:49 ` Daniel Jacobowitz
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-05-23 3:13 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> Ping
Ping, and O yeah, I updated the patch the best I could to get the code
to conform with the GNU coding standards. I hope I'm getting this right.
Thanks,
Bob Rossi
+2005-05-22 Bob Rossi <bob@brasko.net>
+
+ * 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
+++ src/gdb/doc/ChangeLog 22 May 2005 20:41:39 -0000
@@ -1,3 +1,8 @@
+2005-05-22 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-05-22 Bob Rossi <bob@brasko.net>
+
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command
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 22 May 2005 20:41:33 -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
Index: src/gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- src/gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ src/gdb/infcmd.c 22 May 2005 20:41:34 -0000
@@ -136,7 +136,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
@@ -203,6 +203,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)
{
@@ -376,7 +394,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
@@ -1994,6 +2012,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.71
diff -w -u -r1.71 inferior.h
--- src/gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ src/gdb/inferior.h 22 May 2005 20:41:34 -0000
@@ -103,9 +103,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 22 May 2005 20:41:35 -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.110
diff -w -u -r1.110 win32-nat.c
--- src/gdb/win32-nat.c 27 Mar 2005 05:21:12 -0000 1.110
+++ src/gdb/win32-nat.c 22 May 2005 20:41:36 -0000
@@ -1735,6 +1735,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.255
diff -w -u -r1.255 gdb.texinfo
--- src/gdb/doc/gdb.texinfo 20 May 2005 14:58:38 -0000 1.255
+++ src/gdb/doc/gdb.texinfo 22 May 2005 20:41:52 -0000
@@ -19080,6 +19080,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 22 May 2005 20:41:52 -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 22 May 2005 20:41:52 -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 22 May 2005 20:41:52 -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 22 May 2005 20:42:00 -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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-23 3:13 ` Bob Rossi
@ 2005-05-28 23:49 ` Daniel Jacobowitz
2005-05-29 8:37 ` Eli Zaretskii
2005-05-30 15:48 ` Bob Rossi
0 siblings, 2 replies; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-05-28 23:49 UTC (permalink / raw)
To: gdb-patches
On Sun, May 22, 2005 at 05:00:40PM -0400, Bob Rossi wrote:
> On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> > Ping
>
> Ping, and O yeah, I updated the patch the best I could to get the code
> to conform with the GNU coding standards. I hope I'm getting this right.
Not quite, but I don't mind proofreading :-)
> +2005-05-22 Bob Rossi <bob@brasko.net>
> +
> + * fork-child.c (fork-inferior): Use accessor function for
> + inferior_io_terminal
> + * infcmd.c (inferior_io_terminal): make static
All ChangeLog entries should start with a capital letter, end with a
period, and be generally sentencelike. You've got the third bit down.
> + (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
Just "New function" is usually fine.
> + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set/inferior-tty-show
Please use "and" instead of /.
> + const char *inferior_io_terminal = get_inferior_io_terminal();
That pesky space! :-)
> /* 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);
Another pesky space; please use "char *".
> + if (inferior_io_terminal)
> + xfree ( inferior_io_terminal );
Some pesky anti-spaces.
> + /* 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);
> +
Ditto on the pesky spaces. The Usage: bit is unnecessary. There are
no other set commands with underscores; inferior-tty would be better,
but would just "tty" be OK? That's even simpler.
> -/* 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. */
Get doesn't need to be capitalized here. Also, it's still a file name;
could you leave that?
> +Set terminal for future runs of program being debugged.
I think there's either one or two missing uses of "the" here; at least
one before program.
> +/* Set the inferior terminal device name */
Full sentence with a full stop at the end, please.
> + # test that the commands,
> + # -inferior-tty-set
> + # -inferior-tth-show
Test that they what? Or just "Test the commands:".
I tried to point out one example of each of the formatting problems;
that wasn't an exhaustive list, but you can probably see all the others
now.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-28 23:49 ` Daniel Jacobowitz
@ 2005-05-29 8:37 ` Eli Zaretskii
2005-05-29 16:22 ` Daniel Jacobowitz
2005-05-30 15:48 ` Bob Rossi
2005-05-30 15:48 ` Bob Rossi
1 sibling, 2 replies; 49+ messages in thread
From: Eli Zaretskii @ 2005-05-29 8:37 UTC (permalink / raw)
To: gdb-patches
> Date: Sat, 28 May 2005 19:08:55 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Sun, May 22, 2005 at 05:00:40PM -0400, Bob Rossi wrote:
> > On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> > > Ping
> >
> > Ping, and O yeah, I updated the patch the best I could to get the code
> > to conform with the GNU coding standards. I hope I'm getting this right.
>
> Not quite, but I don't mind proofreading :-)
Sorry, I somehow managed to miss the original message. My comments
are below.
> + /* 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);
You are adding a new user command, but you didn't add its
documentation to gdb.texinfo. Please add that; I don't want us to
ever have undocumented commands again.
And I agree with Daniel: let's get rid of that underscore in the
command's name.
> +Show terminal for future runs of program being debugged.
I think the ``future'' part should be removed from this sentence: what
this command outputs is the terminal used _now_ as well as in the
future.
> + (set_inferior_io_terminal): Add accessor definition
> + (get_inferior_io_terminal): Add accessor definition
You don't need to write the description of the change more than once.
Here's my suggestion for how to rewrite this:
(set_inferior_io_terminal, get_inferior_io_terminal): Add
accessor definition.
> + * inferior.h (set_inferior_io_terminal): Add accessor declaration
> + (get_inferior_io_terminal): Add accessor declaration
Same here.
> + * nto-procfs (procfs_create_inferior): Use accessor function
> + * win32-nat.c (child_create_inferior): Use accessor function
Same here:
* nto-procfs.c (procfs_create_inferior)
* win32-nat.c (child_create_inferior): Use get_inferior_io_terminal.
Note how I used the explicit name of the function used, instead of
just "accessor function".
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-29 8:37 ` Eli Zaretskii
@ 2005-05-29 16:22 ` Daniel Jacobowitz
2005-05-29 18:10 ` Eli Zaretskii
2005-05-30 15:48 ` Bob Rossi
1 sibling, 1 reply; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-05-29 16:22 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Sun, May 29, 2005 at 09:55:23AM +0300, Eli Zaretskii wrote:
> > +Show terminal for future runs of program being debugged.
>
> I think the ``future'' part should be removed from this sentence: what
> this command outputs is the terminal used _now_ as well as in the
> future.
That's not strictly true. It is the terminal that will be used the
next time we start the program; we don't know at this point whether
it's currently in use or whether the user has changed it since we last
started the program. We don't have any way to change it in mid-flight.
> * nto-procfs.c (procfs_create_inferior)
> * win32-nat.c (child_create_inferior): Use get_inferior_io_terminal.
>
> Note how I used the explicit name of the function used, instead of
> just "accessor function".
Did you mean:
* nto-procfs.c (procfs_create_inferior): Use
get_inferior_io_terminal.
* win32-nat.c (child_create_inferior): Likewise.
?
I thought it was incorrect to have no colon and log message
corresponding to a bullet.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-29 16:22 ` Daniel Jacobowitz
@ 2005-05-29 18:10 ` Eli Zaretskii
2005-05-29 19:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-05-29 18:10 UTC (permalink / raw)
To: gdb-patches
> Date: Sun, 29 May 2005 10:26:33 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sources.redhat.com
>
> On Sun, May 29, 2005 at 09:55:23AM +0300, Eli Zaretskii wrote:
> > > +Show terminal for future runs of program being debugged.
> >
> > I think the ``future'' part should be removed from this sentence: what
> > this command outputs is the terminal used _now_ as well as in the
> > future.
>
> That's not strictly true. It is the terminal that will be used the
> next time we start the program; we don't know at this point whether
> it's currently in use or whether the user has changed it since we last
> started the program.
That's true, but while for "set" we _know_ the value will be used only
in the future, we don't know that for sure in the case of "show". If
someone can come up with a better wording, I'll be glad to hear. But
to say "show terminal for future runs" would be misleading, I think.
> > * nto-procfs.c (procfs_create_inferior)
> > * win32-nat.c (child_create_inferior): Use get_inferior_io_terminal.
> >
> > Note how I used the explicit name of the function used, instead of
> > just "accessor function".
>
> Did you mean:
> * nto-procfs.c (procfs_create_inferior): Use
> get_inferior_io_terminal.
> * win32-nat.c (child_create_inferior): Likewise.
>
> ?
No, I meant what I wrote.
> I thought it was incorrect to have no colon and log message
> corresponding to a bullet.
AFAIK, it _is_ correct.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-29 18:10 ` Eli Zaretskii
@ 2005-05-29 19:05 ` Daniel Jacobowitz
0 siblings, 0 replies; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-05-29 19:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Sun, May 29, 2005 at 08:48:23PM +0300, Eli Zaretskii wrote:
> > > * nto-procfs.c (procfs_create_inferior)
> > > * win32-nat.c (child_create_inferior): Use get_inferior_io_terminal.
> > >
> > > Note how I used the explicit name of the function used, instead of
> > > just "accessor function".
> >
> > Did you mean:
> > * nto-procfs.c (procfs_create_inferior): Use
> > get_inferior_io_terminal.
> > * win32-nat.c (child_create_inferior): Likewise.
> >
> > ?
>
> No, I meant what I wrote.
>
> > I thought it was incorrect to have no colon and log message
> > corresponding to a bullet.
>
> AFAIK, it _is_ correct.
I've never seen this style used before, in GDB or elsewhere, nor can I
find support for this in standards.texi, which only mentions the
abbreviated form for lists of functions. Which doesn't mean you're
wrong, of course.
FYI, a little sed program to see:
sed -n '/)$/ {h; n; /^\t\*/ { H; x; p; a\\
} }' ChangeLog*
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-29 8:37 ` Eli Zaretskii
2005-05-29 16:22 ` Daniel Jacobowitz
@ 2005-05-30 15:48 ` Bob Rossi
2005-06-01 0:14 ` Bob Rossi
1 sibling, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-05-30 15:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Sun, May 29, 2005 at 09:55:23AM +0300, Eli Zaretskii wrote:
> > Date: Sat, 28 May 2005 19:08:55 -0400
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > On Sun, May 22, 2005 at 05:00:40PM -0400, Bob Rossi wrote:
> > > On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> > > > Ping
> > >
> > > Ping, and O yeah, I updated the patch the best I could to get the code
> > > to conform with the GNU coding standards. I hope I'm getting this right.
> >
> > Not quite, but I don't mind proofreading :-)
>
> Sorry, I somehow managed to miss the original message. My comments
> are below.
>
> > + /* 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);
>
> You are adding a new user command, but you didn't add its
> documentation to gdb.texinfo. Please add that; I don't want us to
> ever have undocumented commands again.
>
> And I agree with Daniel: let's get rid of that underscore in the
> command's name.
Oops, I don't know how I missed that. I added the doco for the MI
commands and this must have slipped passed me.
I'm having trouble finding a particular spot in the manual for this
command. Do you have any suggestions?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-28 23:49 ` Daniel Jacobowitz
2005-05-29 8:37 ` Eli Zaretskii
@ 2005-05-30 15:48 ` Bob Rossi
1 sibling, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-05-30 15:48 UTC (permalink / raw)
To: gdb-patches
Sorry Daniel, this patch was old and I had already reformatted most of
the problems you noticed. I have been paying attention to the spacing
issues and wouldn't try to waste your time.
Here is an updated patch which should take into account all of the
problems. However, it is of course possible problems still exist.
On Sat, May 28, 2005 at 07:08:55PM -0400, Daniel Jacobowitz wrote:
> On Sun, May 22, 2005 at 05:00:40PM -0400, Bob Rossi wrote:
> > On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> > > Ping
> >
> > Ping, and O yeah, I updated the patch the best I could to get the code
> > to conform with the GNU coding standards. I hope I'm getting this right.
>
> Not quite, but I don't mind proofreading :-)
>
> > +2005-05-22 Bob Rossi <bob@brasko.net>
> > +
> > + * fork-child.c (fork-inferior): Use accessor function for
> > + inferior_io_terminal
> > + * infcmd.c (inferior_io_terminal): make static
>
> All ChangeLog entries should start with a capital letter, end with a
> period, and be generally sentencelike. You've got the third bit down.
Done.
> > + (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
>
> Just "New function" is usually fine.
Done.
> > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set/inferior-tty-show
>
> Please use "and" instead of /.
>
> > + const char *inferior_io_terminal = get_inferior_io_terminal();
>
> That pesky space! :-)
Done.
> > /* 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);
>
> Another pesky space; please use "char *".
Done.
> > + if (inferior_io_terminal)
> > + xfree ( inferior_io_terminal );
>
> Some pesky anti-spaces.
Done.
> > + /* 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);
> > +
>
> Ditto on the pesky spaces. The Usage: bit is unnecessary. There are
> no other set commands with underscores; inferior-tty would be better,
> but would just "tty" be OK? That's even simpler.
I changed it to inferior-tty. If you insist on "tty", I'll change it.
However, I was thinking with MI, there might one day be console-tty.
> > -/* 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. */
>
> Get doesn't need to be capitalized here. Also, it's still a file name;
> could you leave that?
OK, done.
> > +Set terminal for future runs of program being debugged.
>
> I think there's either one or two missing uses of "the" here; at least
> one before program.
Done.
> > +/* Set the inferior terminal device name */
>
> Full sentence with a full stop at the end, please.
Done.
> > + # test that the commands,
> > + # -inferior-tty-set
> > + # -inferior-tth-show
>
> Test that they what? Or just "Test the commands:".
Hmm, I must have feel asleep ..., I'm over worked and under payed :)
> I tried to point out one example of each of the formatting problems;
> that wasn't an exhaustive list, but you can probably see all the others
> now.
Thanks for doing this. I should be capable of getting this mostly
correct from now on. I wouldn't expect to see to many spacing errors.
Thanks,
Bob Rossi
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): New function.
+ (get_inferior_io_terminal): Ditto.
+ (tty_command): Use accessor function.
+ (_initialize_infcmd): Add inferior_tty setshow variable.
+ * inferior.h (set_inferior_io_terminal): New prototype.
+ (get_inferior_io_terminal): Ditto.
+ * nto-procfs (procfs_create_inferior): Use accessor function.
+ * win32-nat.c (child_create_inferior): Ditto.
+ * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
+ (mi_cmd_inferior_tty_set): Ditto.
+ * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
+ * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
+ (mi_cmd_inferior_tty_show): Ditto.
Index: src/gdb/doc/ChangeLog
+ * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
+ (GDB/MI Miscellaneous Commands): Add -inferior-tty-show.
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 29 May 2005 23:09:28 -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
Index: src/gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- src/gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ src/gdb/infcmd.c 29 May 2005 23:09:29 -0000
@@ -136,7 +136,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
@@ -203,6 +203,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)
{
@@ -376,7 +394,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
@@ -1994,6 +2012,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.71
diff -w -u -r1.71 inferior.h
--- src/gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ src/gdb/inferior.h 29 May 2005 23:09:30 -0000
@@ -103,9 +103,10 @@
extern void clear_sigio_trap (void);
-/* File name for default use for standard in/out in the inferior. */
+/* Set/get file 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 29 May 2005 23:09:30 -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.111
diff -w -u -r1.111 win32-nat.c
--- src/gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
+++ src/gdb/win32-nat.c 29 May 2005 23:09:31 -0000
@@ -1735,6 +1735,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.257
diff -w -u -r1.257 gdb.texinfo
--- src/gdb/doc/gdb.texinfo 26 May 2005 19:28:23 -0000 1.257
+++ src/gdb/doc/gdb.texinfo 29 May 2005 23:09:47 -0000
@@ -19092,6 +19092,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 the 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 29 May 2005 23:09:47 -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 29 May 2005 23:09:47 -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 29 May 2005 23:09:47 -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/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1119
diff -w -u -r1.1119 ChangeLog
--- src/gdb/testsuite/ChangeLog 29 May 2005 01:58:53 -0000 1.1119
+++ src/gdb/testsuite/ChangeLog 29 May 2005 23:09:55 -0000
@@ -1,3 +1,8 @@
+2005-05-28 Bob Rossi <bob@brasko.net>
+
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command.
+
2005-05-29 Joel Brobecker <brobecker@adacore.com>
* gdb.arch/alpha-step.c: New file.
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 29 May 2005 23:09:56 -0000
@@ -236,12 +236,42 @@
}
+proc test_setshow_inferior_tty {} {
+ global mi_gdb_prompt
+
+ # Test that the commands,
+ # -inferior-tty-set
+ # -inferior-tth-show
+ # are setting/getting the same data in GDB.
+
+ 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-05-30 15:48 ` Bob Rossi
@ 2005-06-01 0:14 ` Bob Rossi
2005-06-01 4:00 ` Eli Zaretskii
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-06-01 0:14 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
On Sun, May 29, 2005 at 04:54:35PM -0400, Bob Rossi wrote:
> On Sun, May 29, 2005 at 09:55:23AM +0300, Eli Zaretskii wrote:
> > > Date: Sat, 28 May 2005 19:08:55 -0400
> > > From: Daniel Jacobowitz <drow@false.org>
> > >
> > > On Sun, May 22, 2005 at 05:00:40PM -0400, Bob Rossi wrote:
> > > > On Thu, Mar 10, 2005 at 09:26:44PM -0500, Bob Rossi wrote:
> > > > > Ping
> > > >
> > > > Ping, and O yeah, I updated the patch the best I could to get the code
> > > > to conform with the GNU coding standards. I hope I'm getting this right.
> > >
> > > Not quite, but I don't mind proofreading :-)
> >
> > Sorry, I somehow managed to miss the original message. My comments
> > are below.
> >
> > > + /* 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);
> >
> > You are adding a new user command, but you didn't add its
> > documentation to gdb.texinfo. Please add that; I don't want us to
> > ever have undocumented commands again.
> >
> > And I agree with Daniel: let's get rid of that underscore in the
> > command's name.
>
> Oops, I don't know how I missed that. I added the doco for the MI
> commands and this must have slipped passed me.
>
> I'm having trouble finding a particular spot in the manual for this
> command. Do you have any suggestions?
Eli, is the MI doco good enough? or do you want the doco for set/show?
If you want the set/show doco, please let me know where to put it in the
manual.
Thanks very much,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 0:14 ` Bob Rossi
@ 2005-06-01 4:00 ` Eli Zaretskii
2005-06-01 13:07 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-01 4:00 UTC (permalink / raw)
To: gdb-patches
> Date: Tue, 31 May 2005 20:14:40 -0400
> From: Bob Rossi <bob@brasko.net>
>
> > I'm having trouble finding a particular spot in the manual for this
> > command. Do you have any suggestions?
>
> Eli, is the MI doco good enough? or do you want the doco for set/show?
I want both ;-)
> If you want the set/show doco, please let me know where to put it in the
> manual.
Very strange: I replied to this question 2 days ago, but I cannot find
my response in the gdb-patches archives.
Here it is again. Please note the question about the "tty" command.
> Date: Sun, 29 May 2005 16:54:35 -0400
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
>
> I'm having trouble finding a particular spot in the manual for this
> command. Do you have any suggestions?
The node "Input/Output" seems like a perfect place.
Which reminds me: now that you introduced "set tty", doesn't that mean
we should remove the "tty" command as redundant?
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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:12 ` Eli Zaretskii
0 siblings, 2 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-01 13:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Wed, Jun 01, 2005 at 07:00:18AM +0300, Eli Zaretskii wrote:
> > Date: Tue, 31 May 2005 20:14:40 -0400
> > From: Bob Rossi <bob@brasko.net>
> >
> > > I'm having trouble finding a particular spot in the manual for this
> > > command. Do you have any suggestions?
> >
> > Eli, is the MI doco good enough? or do you want the doco for set/show?
>
> I want both ;-)
OK. I can handle that.
> > If you want the set/show doco, please let me know where to put it in the
> > manual.
>
> Very strange: I replied to this question 2 days ago, but I cannot find
> my response in the gdb-patches archives.
>
> Here it is again. Please note the question about the "tty" command.
>
> > Date: Sun, 29 May 2005 16:54:35 -0400
> > From: Bob Rossi <bob@brasko.net>
> > Cc: gdb-patches@sources.redhat.com
> >
> > I'm having trouble finding a particular spot in the manual for this
> > command. Do you have any suggestions?
>
> The node "Input/Output" seems like a perfect place.
OK, thanks.
> Which reminds me: now that you introduced "set tty", doesn't that mean
> we should remove the "tty" command as redundant?
I don't think so. Simply because the tty command has been around for
ages and FE's depend on it being there. Removing the tty command would
successfully break every front end. Then, it would be necessary for FE's
to start trying to figure out what version of GDB they are using to
determine how to give it a tty. This is a difficult in itself with the
MI interface, never mind the CLI.
On the other hand, if it is unacceptable to leave both commands in GDB,
I could send both commands
tty /dev/pts/1
set inferior-tty /dev/pts/1
to GDB and not worry about the results.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 13:07 ` Bob Rossi
@ 2005-06-01 17:42 ` Bob Rossi
2005-06-01 20:25 ` Eli Zaretskii
2005-06-01 20:12 ` Eli Zaretskii
1 sibling, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-06-01 17:42 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
On Wed, Jun 01, 2005 at 09:06:53AM -0400, Bob Rossi wrote:
> On Wed, Jun 01, 2005 at 07:00:18AM +0300, Eli Zaretskii wrote:
> > > Date: Tue, 31 May 2005 20:14:40 -0400
> > > From: Bob Rossi <bob@brasko.net>
> > >
> > > > I'm having trouble finding a particular spot in the manual for this
> > > > command. Do you have any suggestions?
> > >
> > > Eli, is the MI doco good enough? or do you want the doco for set/show?
> >
> > I want both ;-)
>
> OK. I can handle that.
>
> > > If you want the set/show doco, please let me know where to put it in the
> > > manual.
> >
> > Very strange: I replied to this question 2 days ago, but I cannot find
> > my response in the gdb-patches archives.
> >
> > Here it is again. Please note the question about the "tty" command.
> >
> > > Date: Sun, 29 May 2005 16:54:35 -0400
> > > From: Bob Rossi <bob@brasko.net>
> > > Cc: gdb-patches@sources.redhat.com
> > >
> > > I'm having trouble finding a particular spot in the manual for this
> > > command. Do you have any suggestions?
> >
> > The node "Input/Output" seems like a perfect place.
>
> OK, thanks.
>
> > Which reminds me: now that you introduced "set tty", doesn't that mean
> > we should remove the "tty" command as redundant?
>
> I don't think so. Simply because the tty command has been around for
> ages and FE's depend on it being there. Removing the tty command would
> successfully break every front end. Then, it would be necessary for FE's
> to start trying to figure out what version of GDB they are using to
> determine how to give it a tty. This is a difficult in itself with the
> MI interface, never mind the CLI.
>
> On the other hand, if it is unacceptable to leave both commands in GDB,
> I could send both commands
> tty /dev/pts/1
> set inferior-tty /dev/pts/1
> to GDB and not worry about the results.
Here's the whole patch, inlcuding the doco.
Thanks,
Bob Rossi
Index: 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): New function.
+ (get_inferior_io_terminal): Ditto.
+ (tty_command): Use accessor function.
+ (_initialize_infcmd): Add inferior_tty setshow variable.
+ * inferior.h (set_inferior_io_terminal): New prototype.
+ (get_inferior_io_terminal): Ditto.
+ * nto-procfs (procfs_create_inferior): Use accessor function.
+ * win32-nat.c (child_create_inferior): Ditto.
+ * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
+ (mi_cmd_inferior_tty_set): Ditto.
+ * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
+ * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
+ (mi_cmd_inferior_tty_show): Ditto.
Index: gdb/doc/ChangeLog
+ * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
+ (GDB/MI Miscellaneous Commands): Add -inferior-tty-show.
+ (Input/Output): Document "set/show inferior-tty".
Index: 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
--- gdb/fork-child.c 12 May 2005 20:21:17 -0000 1.26
+++ gdb/fork-child.c 1 Jun 2005 17:12:26 -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
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ gdb/infcmd.c 1 Jun 2005 17:12:27 -0000
@@ -136,7 +136,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
@@ -203,6 +203,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)
{
@@ -376,7 +394,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
@@ -1994,6 +2012,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: gdb/inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.71
diff -w -u -r1.71 inferior.h
--- gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ gdb/inferior.h 1 Jun 2005 17:12:27 -0000
@@ -103,9 +103,10 @@
extern void clear_sigio_trap (void);
-/* File name for default use for standard in/out in the inferior. */
+/* Set/get file 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: 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
--- gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
+++ gdb/nto-procfs.c 1 Jun 2005 17:12:28 -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: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.111
diff -w -u -r1.111 win32-nat.c
--- gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
+++ gdb/win32-nat.c 1 Jun 2005 17:12:29 -0000
@@ -1735,6 +1735,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: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.258
diff -w -u -r1.258 gdb.texinfo
--- gdb/doc/gdb.texinfo 29 May 2005 03:13:18 -0000 1.258
+++ gdb/doc/gdb.texinfo 1 Jun 2005 17:12:45 -0000
@@ -2090,6 +2090,22 @@
command, only the input @emph{for your program} is affected. The input
for @value{GDBN} still comes from your terminal.
+@vindex inferior-tty
+@cindex Set the inferior controlling terminal
+Yet another way to tell @value{GDBN} where you program should do input
+and output is with the @code{set inferior-tty} command. This is currently
+the same as using the @code{tty} command.
+
+@table @code
+@item set inferior-tty /dev/ttyb
+@kindex set inferior-tty
+Set the tty for the program being debugged to /dev/ttyb.
+
+@item show inferior-tty
+@kindex show inferior-tty
+Show the current tty for the program being debugged.
+@end table
+
@node Attach
@section Debugging an already-running process
@kindex attach
@@ -19123,6 +19139,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 the 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: 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
--- gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
+++ gdb/mi/mi-cmd-env.c 1 Jun 2005 17:12:45 -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: 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
--- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
+++ gdb/mi/mi-cmds.c 1 Jun 2005 17:12:46 -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: 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
--- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
+++ gdb/mi/mi-cmds.h 1 Jun 2005 17:12:46 -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: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1119
diff -w -u -r1.1119 ChangeLog
--- gdb/testsuite/ChangeLog 29 May 2005 01:58:53 -0000 1.1119
+++ gdb/testsuite/ChangeLog 1 Jun 2005 17:12:53 -0000
@@ -1,3 +1,8 @@
+2005-05-28 Bob Rossi <bob@brasko.net>
+
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command.
+
2005-05-29 Joel Brobecker <brobecker@adacore.com>
* gdb.arch/alpha-step.c: New file.
Index: 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
--- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
+++ gdb/testsuite/gdb.mi/mi-basics.exp 1 Jun 2005 17:12:54 -0000
@@ -236,12 +236,42 @@
}
+proc test_setshow_inferior_tty {} {
+ global mi_gdb_prompt
+
+ # Test that the commands,
+ # -inferior-tty-set
+ # -inferior-tth-show
+ # are setting/getting the same data in GDB.
+
+ 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 13:07 ` Bob Rossi
2005-06-01 17:42 ` Bob Rossi
@ 2005-06-01 20:12 ` Eli Zaretskii
2005-06-01 20:43 ` Bob Rossi
1 sibling, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-01 20:12 UTC (permalink / raw)
To: gdb-patches
> Date: Wed, 1 Jun 2005 09:06:53 -0400
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
>
> > Which reminds me: now that you introduced "set tty", doesn't that mean
> > we should remove the "tty" command as redundant?
>
> I don't think so. Simply because the tty command has been around for
> ages and FE's depend on it being there. Removing the tty command would
> successfully break every front end.
Not if we leave "tty" as an alias for "set tty". Any objections to do
that as part of your patch?
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 17:42 ` Bob Rossi
@ 2005-06-01 20:25 ` Eli Zaretskii
2005-06-02 22:17 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-01 20:25 UTC (permalink / raw)
To: gdb-patches
> Date: Wed, 1 Jun 2005 13:41:49 -0400
> From: Bob Rossi <bob@brasko.net>
>
> Here's the whole patch, inlcuding the doco.
Thanks.
> Index: gdb/doc/ChangeLog
> + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
> + (GDB/MI Miscellaneous Commands): Add -inferior-tty-show.
> + (Input/Output): Document "set/show inferior-tty".
There's no need to mention the same node twice. I suggest to reformat
as follows:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
and -inferior-tty-show.
(Input/Output): Document "set/show inferior-tty".
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.258
> diff -w -u -r1.258 gdb.texinfo
> --- gdb/doc/gdb.texinfo 29 May 2005 03:13:18 -0000 1.258
> +++ gdb/doc/gdb.texinfo 1 Jun 2005 17:12:45 -0000
> @@ -2090,6 +2090,22 @@
> command, only the input @emph{for your program} is affected. The input
> for @value{GDBN} still comes from your terminal.
>
> +@vindex inferior-tty
Please don't use @vindex for the "set SOMETHING" commands, we don't do
that in GDB. @vindex is generally reserved for convenience variables.
I suggest to have a "@cindex inferior tty" entry, though.
> +@cindex Set the inferior controlling terminal
Please remove "the", and please don't start the index entries with a
capital letter. The convention in GDB (and the preferred style in
any manual) is not to capitalize index entries.
> +Yet another way to tell @value{GDBN} where you program should do input
> +and output is with the @code{set inferior-tty} command. This is currently
> +the same as using the @code{tty} command.
If we do what I think we should do, i.e. make "tty" an alias to "set
inferior-tty", this paragraph will have to be rewritten.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 20:12 ` Eli Zaretskii
@ 2005-06-01 20:43 ` Bob Rossi
2005-06-02 3:48 ` Eli Zaretskii
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-06-01 20:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Wed, Jun 01, 2005 at 11:11:56PM +0300, Eli Zaretskii wrote:
> > Date: Wed, 1 Jun 2005 09:06:53 -0400
> > From: Bob Rossi <bob@brasko.net>
> > Cc: gdb-patches@sources.redhat.com
> >
> > > Which reminds me: now that you introduced "set tty", doesn't that mean
> > > we should remove the "tty" command as redundant?
> >
> > I don't think so. Simply because the tty command has been around for
> > ages and FE's depend on it being there. Removing the tty command would
> > successfully break every front end.
>
> Not if we leave "tty" as an alias for "set tty". Any objections to do
> that as part of your patch?
Yeah, if that leaves the user the 'tty /dev/pts/1' interface, than it's
fine with me. I'd be happy to add it to this patch, I just haven't used
an alias before and will have to look into it.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 20:43 ` Bob Rossi
@ 2005-06-02 3:48 ` Eli Zaretskii
0 siblings, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-02 3:48 UTC (permalink / raw)
To: gdb-patches
> Date: Wed, 1 Jun 2005 16:43:30 -0400
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
>
> > Not if we leave "tty" as an alias for "set tty". Any objections to do
> > that as part of your patch?
>
> Yeah, if that leaves the user the 'tty /dev/pts/1' interface, than it's
> fine with me. I'd be happy to add it to this patch, I just haven't used
> an alias before and will have to look into it.
You want `add_com_alias'.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-01 20:25 ` Eli Zaretskii
@ 2005-06-02 22:17 ` Bob Rossi
2005-06-03 6:48 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-02 22:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Wed, Jun 01, 2005 at 11:25:16PM +0300, Eli Zaretskii wrote:
> > Date: Wed, 1 Jun 2005 13:41:49 -0400
> > From: Bob Rossi <bob@brasko.net>
> >
> > Here's the whole patch, inlcuding the doco.
>
> Thanks.
>
> > Index: gdb/doc/ChangeLog
> > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
> > + (GDB/MI Miscellaneous Commands): Add -inferior-tty-show.
> > + (Input/Output): Document "set/show inferior-tty".
>
> There's no need to mention the same node twice. I suggest to reformat
> as follows:
>
> * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
> and -inferior-tty-show.
> (Input/Output): Document "set/show inferior-tty".
Done.
> > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> > retrieving revision 1.258
> > diff -w -u -r1.258 gdb.texinfo
> > --- gdb/doc/gdb.texinfo 29 May 2005 03:13:18 -0000 1.258
> > +++ gdb/doc/gdb.texinfo 1 Jun 2005 17:12:45 -0000
> > @@ -2090,6 +2090,22 @@
> > command, only the input @emph{for your program} is affected. The input
> > for @value{GDBN} still comes from your terminal.
> >
> > +@vindex inferior-tty
>
> Please don't use @vindex for the "set SOMETHING" commands, we don't do
> that in GDB. @vindex is generally reserved for convenience variables.
>
> I suggest to have a "@cindex inferior tty" entry, though.
Done.
> > +@cindex Set the inferior controlling terminal
>
> Please remove "the", and please don't start the index entries with a
> capital letter. The convention in GDB (and the preferred style in
> any manual) is not to capitalize index entries.
>
Done.
> > +Yet another way to tell @value{GDBN} where you program should do input
> > +and output is with the @code{set inferior-tty} command. This is currently
> > +the same as using the @code{tty} command.
>
> If we do what I think we should do, i.e. make "tty" an alias to "set
> inferior-tty", this paragraph will have to be rewritten.
Done.
Below is a patch with all of the changes both you and Daniel have
pointed out.
Thanks very much,
Bob Rossi
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): New function.
+ (get_inferior_io_terminal): Ditto.
+ (tty_command): Use accessor function.
+ (_initialize_infcmd): Add inferior_tty setshow variable.
+ (_initialize_infcmd): Remove tty command.
+ (_initialize_infcmd): Add a tty command that is an alias.
+ * inferior.h (set_inferior_io_terminal): New prototype.
+ (get_inferior_io_terminal): Ditto.
+ * nto-procfs (procfs_create_inferior): Use accessor function.
+ * win32-nat.c (child_create_inferior): Ditto.
+ * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
+ (mi_cmd_inferior_tty_set): Ditto.
+ * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
+ * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
+ (mi_cmd_inferior_tty_show): Ditto.
Index: src/gdb/doc/ChangeLog
+ * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
+ and -inferior-tty-show.
+ (Input/Output): Document "set/show inferior-tty" and tty alias.
Index: src/gdb/testsuite/ChangeLog
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command.
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
Index: src/gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- src/gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ src/gdb/infcmd.c 2 Jun 2005 22:12:32 -0000
@@ -136,7 +136,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
@@ -203,6 +203,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)
{
@@ -376,7 +394,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
@@ -1990,9 +2008,14 @@
{
struct cmd_list_element *c;
- 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);
add_setshow_optional_filename_cmd ("args", class_run,
&inferior_args, _("\
Index: src/gdb/inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.71
diff -w -u -r1.71 inferior.h
--- src/gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ src/gdb/inferior.h 2 Jun 2005 22:12:33 -0000
@@ -103,9 +103,10 @@
extern void clear_sigio_trap (void);
-/* File name for default use for standard in/out in the inferior. */
+/* Set/get file 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 2 Jun 2005 22:12:33 -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.111
diff -w -u -r1.111 win32-nat.c
--- src/gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
+++ src/gdb/win32-nat.c 2 Jun 2005 22:12:35 -0000
@@ -1735,6 +1735,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.259
diff -w -u -r1.259 gdb.texinfo
--- src/gdb/doc/gdb.texinfo 1 Jun 2005 20:38:44 -0000 1.259
+++ src/gdb/doc/gdb.texinfo 2 Jun 2005 22:12:50 -0000
@@ -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.
+
+@table @code
+@item set inferior-tty /dev/ttyb
+@kindex set inferior-tty
+Set the tty for the program being debugged to /dev/ttyb.
+
+@item show inferior-tty
+@kindex show inferior-tty
+Show the current tty for the program being debugged.
+@end table
@node Attach
@section Debugging an already-running process
@@ -19122,6 +19139,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 the 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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:59 -0000
@@ -236,12 +236,42 @@
}
+proc test_setshow_inferior_tty {} {
+ global mi_gdb_prompt
+
+ # Test that the commands,
+ # -inferior-tty-set
+ # -inferior-tth-show
+ # are setting/getting the same data in GDB.
+
+ 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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-13 3:07 ` Daniel Jacobowitz
2 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-03 6:48 UTC (permalink / raw)
To: gdb-patches
> Date: Thu, 2 Jun 2005 18:16:44 -0400
> From: Bob Rossi <bob@brasko.net>
> Cc: gdb-patches@sources.redhat.com
>
> Below is a patch with all of the changes both you and Daniel have
> pointed out.
I'm happy now. Thanks.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-03 6:48 ` Eli Zaretskii
@ 2005-06-03 17:32 ` Bob Rossi
0 siblings, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-03 17:32 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Fri, Jun 03, 2005 at 09:48:12AM +0300, Eli Zaretskii wrote:
> > Date: Thu, 2 Jun 2005 18:16:44 -0400
> > From: Bob Rossi <bob@brasko.net>
> > Cc: gdb-patches@sources.redhat.com
> >
> > Below is a patch with all of the changes both you and Daniel have
> > pointed out.
>
> I'm happy now. Thanks.
Daniel, am I OK to apply this patch? or did you still have to review it?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-02 22:17 ` Bob Rossi
2005-06-03 6:48 ` Eli Zaretskii
@ 2005-06-10 2:28 ` Bob Rossi
2005-06-10 6:36 ` Eli Zaretskii
2005-06-13 3:07 ` Daniel Jacobowitz
2 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-06-10 2:28 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches; +Cc: Daniel Jacobowitz
Hi all,
1 week ping.
Thanks,
Bob Rossi
On Thu, Jun 02, 2005 at 06:16:44PM -0400, Bob Rossi wrote:
> On Wed, Jun 01, 2005 at 11:25:16PM +0300, Eli Zaretskii wrote:
> > > Date: Wed, 1 Jun 2005 13:41:49 -0400
> > > From: Bob Rossi <bob@brasko.net>
> > >
> > > Here's the whole patch, inlcuding the doco.
> >
> > Thanks.
> >
> > > Index: gdb/doc/ChangeLog
> > > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
> > > + (GDB/MI Miscellaneous Commands): Add -inferior-tty-show.
> > > + (Input/Output): Document "set/show inferior-tty".
> >
> > There's no need to mention the same node twice. I suggest to reformat
> > as follows:
> >
> > * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set.
> > and -inferior-tty-show.
> > (Input/Output): Document "set/show inferior-tty".
>
> Done.
>
> > > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> > > retrieving revision 1.258
> > > diff -w -u -r1.258 gdb.texinfo
> > > --- gdb/doc/gdb.texinfo 29 May 2005 03:13:18 -0000 1.258
> > > +++ gdb/doc/gdb.texinfo 1 Jun 2005 17:12:45 -0000
> > > @@ -2090,6 +2090,22 @@
> > > command, only the input @emph{for your program} is affected. The input
> > > for @value{GDBN} still comes from your terminal.
> > >
> > > +@vindex inferior-tty
> >
> > Please don't use @vindex for the "set SOMETHING" commands, we don't do
> > that in GDB. @vindex is generally reserved for convenience variables.
> >
> > I suggest to have a "@cindex inferior tty" entry, though.
>
> Done.
> > > +@cindex Set the inferior controlling terminal
> >
> > Please remove "the", and please don't start the index entries with a
> > capital letter. The convention in GDB (and the preferred style in
> > any manual) is not to capitalize index entries.
> >
>
> Done.
>
> > > +Yet another way to tell @value{GDBN} where you program should do input
> > > +and output is with the @code{set inferior-tty} command. This is currently
> > > +the same as using the @code{tty} command.
> >
> > If we do what I think we should do, i.e. make "tty" an alias to "set
> > inferior-tty", this paragraph will have to be rewritten.
>
> Done.
>
> Below is a patch with all of the changes both you and Daniel have
> pointed out.
>
> Thanks very much,
> Bob Rossi
>
> 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): New function.
> + (get_inferior_io_terminal): Ditto.
> + (tty_command): Use accessor function.
> + (_initialize_infcmd): Add inferior_tty setshow variable.
> + (_initialize_infcmd): Remove tty command.
> + (_initialize_infcmd): Add a tty command that is an alias.
> + * inferior.h (set_inferior_io_terminal): New prototype.
> + (get_inferior_io_terminal): Ditto.
> + * nto-procfs (procfs_create_inferior): Use accessor function.
> + * win32-nat.c (child_create_inferior): Ditto.
> + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> + (mi_cmd_inferior_tty_set): Ditto.
> + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> + (mi_cmd_inferior_tty_show): Ditto.
>
> Index: src/gdb/doc/ChangeLog
> + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> + and -inferior-tty-show.
> + (Input/Output): Document "set/show inferior-tty" and tty alias.
>
> Index: src/gdb/testsuite/ChangeLog
> + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> + command.
>
> 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
> Index: src/gdb/infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.138
> diff -w -u -r1.138 infcmd.c
> --- src/gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
> +++ src/gdb/infcmd.c 2 Jun 2005 22:12:32 -0000
> @@ -136,7 +136,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
> @@ -203,6 +203,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)
> {
> @@ -376,7 +394,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
> @@ -1990,9 +2008,14 @@
> {
> struct cmd_list_element *c;
>
> - 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);
>
> add_setshow_optional_filename_cmd ("args", class_run,
> &inferior_args, _("\
> Index: src/gdb/inferior.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/inferior.h,v
> retrieving revision 1.71
> diff -w -u -r1.71 inferior.h
> --- src/gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
> +++ src/gdb/inferior.h 2 Jun 2005 22:12:33 -0000
> @@ -103,9 +103,10 @@
>
> extern void clear_sigio_trap (void);
>
> -/* File name for default use for standard in/out in the inferior. */
> +/* Set/get file 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 2 Jun 2005 22:12:33 -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.111
> diff -w -u -r1.111 win32-nat.c
> --- src/gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
> +++ src/gdb/win32-nat.c 2 Jun 2005 22:12:35 -0000
> @@ -1735,6 +1735,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.259
> diff -w -u -r1.259 gdb.texinfo
> --- src/gdb/doc/gdb.texinfo 1 Jun 2005 20:38:44 -0000 1.259
> +++ src/gdb/doc/gdb.texinfo 2 Jun 2005 22:12:50 -0000
> @@ -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.
> +
> +@table @code
> +@item set inferior-tty /dev/ttyb
> +@kindex set inferior-tty
> +Set the tty for the program being debugged to /dev/ttyb.
> +
> +@item show inferior-tty
> +@kindex show inferior-tty
> +Show the current tty for the program being debugged.
> +@end table
>
> @node Attach
> @section Debugging an already-running process
> @@ -19122,6 +19139,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 the 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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:50 -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 2 Jun 2005 22:12:59 -0000
> @@ -236,12 +236,42 @@
>
> }
>
> +proc test_setshow_inferior_tty {} {
> + global mi_gdb_prompt
> +
> + # Test that the commands,
> + # -inferior-tty-set
> + # -inferior-tth-show
> + # are setting/getting the same data in GDB.
> +
> + 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-10 2:28 ` Bob Rossi
@ 2005-06-10 6:36 ` Eli Zaretskii
2005-06-10 11:04 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-10 6:36 UTC (permalink / raw)
To: gdb-patches
> Date: Thu, 9 Jun 2005 22:28:22 -0400
> From: Bob Rossi <bob@brasko.net>
> Cc: Daniel Jacobowitz <drow@false.org>
>
> 1 week ping.
Hey, why do you ping me? I approved the doco part several days ago.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-10 6:36 ` Eli Zaretskii
@ 2005-06-10 11:04 ` Bob Rossi
0 siblings, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-10 11:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Fri, Jun 10, 2005 at 09:36:40AM +0300, Eli Zaretskii wrote:
> > Date: Thu, 9 Jun 2005 22:28:22 -0400
> > From: Bob Rossi <bob@brasko.net>
> > Cc: Daniel Jacobowitz <drow@false.org>
> >
> > 1 week ping.
>
> Hey, why do you ping me? I approved the doco part several days ago.
Hi Eli,
Sorry to bother you. I simply hit "group reply" and then added Daniel's
Email. It won't happen again.
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-02 22:17 ` Bob Rossi
2005-06-03 6:48 ` Eli Zaretskii
2005-06-10 2:28 ` Bob Rossi
@ 2005-06-13 3:07 ` Daniel Jacobowitz
2005-06-13 6:09 ` Eli Zaretskii
2005-06-17 21:08 ` Bob Rossi
2 siblings, 2 replies; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-06-13 3:07 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-13 3:07 ` Daniel Jacobowitz
@ 2005-06-13 6:09 ` Eli Zaretskii
2005-06-17 21:08 ` Bob Rossi
1 sibling, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-13 6:09 UTC (permalink / raw)
To: gdb-patches
> Date: Sun, 12 Jun 2005 23:07:32 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> > @@ -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"?
Yes. I thought of rewriting that section after these patches are
committed.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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
1 sibling, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-06-17 21:08 UTC (permalink / raw)
To: gdb-patches
On Sun, Jun 12, 2005 at 11:07:32PM -0400, Daniel Jacobowitz wrote:
> 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.
Fixed, and thanks for the great suggestion.
> > +void
> > +set_inferior_io_terminal (char *terminal_name)
>
> This argument can be const too.
Fixed.
> > - 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.
I didn't change this, since there is an alias. However, the more I
think about it, it would be fine with me if this was changed to simply
'tty'. Eventually, I might add a console-tty, which is the reason I was
more specific with inferior-tty, instead of just tty. What do you think?
> > @@ -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.
OK, Done.
> > @@ -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.
Done.
> > +/* Print the inferior terminal device name */
>
> Ditto.
Done.
> > + # Test that the commands,
> > + # -inferior-tty-set
> > + # -inferior-tth-show
>
> Typo.
Done.
I do have one problem with this patch, before it can be approved. There
is no file completion for the tty command with the new patch. I can't
figure out how to add file completion with the
add_setshow_string_noescape_cmd command. Do you or anyone else know how
to do this?
Thanks,
Bob Rossi
Index: 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): New function.
+ (get_inferior_io_terminal): Ditto.
+ (tty_command): Use accessor function.
+ (_initialize_infcmd): Add inferior_tty setshow variable.
+ (_initialize_infcmd): Remove tty command.
+ (_initialize_infcmd): Add a tty command that is an alias.
+ * inferior.h (set_inferior_io_terminal): New prototype.
+ (get_inferior_io_terminal): Ditto.
+ (new_tty_prefork): Add const qualifier to parameter.
+ * inflow.c (inferior_thisrun_terminal): Add const qualifier.
+ (new_tty_prefork): Add const qualifier to parameter.
+ * nto-procfs (procfs_create_inferior): Use accessor function.
+ (procfs_create_inferior): Add const qualifier to locals.
+ * win32-nat.c (child_create_inferior): Ditto.
+ * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
+ (mi_cmd_inferior_tty_set): Ditto.
+ * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
+ * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
+ (mi_cmd_inferior_tty_show): Ditto.
Index: gdb/doc/ChangeLog
+ * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
+ and -inferior-tty-show.
+ (Input/Output): Document "set/show inferior-tty" and tty alias.
Index: gdb/testsuite/ChangeLog
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command.
Index: 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
--- gdb/fork-child.c 12 May 2005 20:21:17 -0000 1.26
+++ gdb/fork-child.c 17 Jun 2005 21:01:59 -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. */
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ gdb/infcmd.c 17 Jun 2005 21:02:00 -0000
@@ -136,7 +136,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
@@ -203,6 +203,24 @@
\f
/* Accessor routines. */
+void
+set_inferior_io_terminal (const 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)
{
@@ -376,7 +394,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
@@ -1988,11 +2006,16 @@
void
_initialize_infcmd (void)
{
- struct cmd_list_element *c;
+ struct cmd_list_element *c = NULL;
- c = add_com ("tty", class_run, tty_command,
- _("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 (setlist, filename_completer);
+ add_com_alias ("tty", "set inferior-tty", class_alias, 0);
add_setshow_optional_filename_cmd ("args", class_run,
&inferior_args, _("\
Index: gdb/inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.71
diff -w -u -r1.71 inferior.h
--- gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ gdb/inferior.h 17 Jun 2005 21:02:00 -0000
@@ -103,9 +103,10 @@
extern void clear_sigio_trap (void);
-/* File name for default use for standard in/out in the inferior. */
+/* Set/get file name for default use for standard in/out in the inferior. */
-extern char *inferior_io_terminal;
+extern void set_inferior_io_terminal (const 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. */
@@ -264,7 +265,7 @@
/* From inflow.c */
-extern void new_tty_prefork (char *);
+extern void new_tty_prefork (const char *);
extern int gdb_has_a_terminal (void);
Index: gdb/inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.29
diff -w -u -r1.29 inflow.c
--- gdb/inflow.c 15 Feb 2005 15:49:11 -0000 1.29
+++ gdb/inflow.c 17 Jun 2005 21:02:00 -0000
@@ -94,7 +94,7 @@
/* The name of the tty (from the `tty' command) that we gave to the inferior
when it was last started. */
-static char *inferior_thisrun_terminal;
+static const char *inferior_thisrun_terminal;
/* Nonzero if our terminal settings are in effect. Zero if the
inferior's settings are in effect. Ignored if !gdb_has_a_terminal
@@ -509,7 +509,7 @@
the terminal specified in the NEW_TTY_PREFORK call. */
void
-new_tty_prefork (char *ttyname)
+new_tty_prefork (const char *ttyname)
{
/* Save the name for later, for determining whether we and the child
are sharing a tty. */
Index: 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
--- gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
+++ gdb/nto-procfs.c 17 Jun 2005 21:02:00 -0000
@@ -981,9 +981,10 @@
pid_t pid;
int flags, errn;
char **argv, *args;
- char *in = "", *out = "", *err = "";
+ const 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));
Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.111
diff -w -u -r1.111 win32-nat.c
--- gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
+++ gdb/win32-nat.c 17 Jun 2005 21:02:01 -0000
@@ -1735,6 +1735,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: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.261
diff -w -u -r1.261 gdb.texinfo
--- gdb/doc/gdb.texinfo 7 Jun 2005 15:32:38 -0000 1.261
+++ gdb/doc/gdb.texinfo 17 Jun 2005 21:02:06 -0000
@@ -2095,7 +2095,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.
+
+@table @code
+@item set inferior-tty /dev/ttyb
+@kindex set inferior-tty
+Set the tty for the program being debugged to /dev/ttyb.
+
+@item show inferior-tty
+@kindex show inferior-tty
+Show the current tty for the program being debugged.
+@end table
@node Attach
@section Debugging an already-running process
@@ -19134,6 +19151,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 the 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: 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
--- gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
+++ gdb/mi/mi-cmd-env.c 17 Jun 2005 21:02:06 -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: 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
--- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
+++ gdb/mi/mi-cmds.c 17 Jun 2005 21:02:06 -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: 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
--- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
+++ gdb/mi/mi-cmds.h 17 Jun 2005 21:02:06 -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: 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
--- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
+++ gdb/testsuite/gdb.mi/mi-basics.exp 17 Jun 2005 21:02:09 -0000
@@ -236,12 +236,42 @@
}
+proc test_setshow_inferior_tty {} {
+ global mi_gdb_prompt
+
+ # Test that the commands,
+ # -inferior-tty-set
+ # -inferior-tty-show
+ # are setting/getting the same data in GDB.
+
+ 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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
0 siblings, 2 replies; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-06-17 21:14 UTC (permalink / raw)
To: gdb-patches
On Fri, Jun 17, 2005 at 05:08:11PM -0400, Bob Rossi wrote:
> > > - 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.
>
> I didn't change this, since there is an alias. However, the more I
> think about it, it would be fine with me if this was changed to simply
> 'tty'. Eventually, I might add a console-tty, which is the reason I was
> more specific with inferior-tty, instead of just tty. What do you think?
Right - what we have now is "tty", this patch preserves "tty" and adds
"set inferior-tty". Might as well stay with that. It's a little more
descriptive.
Could you explain what you've got in mind for console-tty?
> I do have one problem with this patch, before it can be approved. There
> is no file completion for the tty command with the new patch. I can't
> figure out how to add file completion with the
> add_setshow_string_noescape_cmd command. Do you or anyone else know how
> to do this?
If it's a filename, perhaps you should be using
add_setshow_filename_cmd instead.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-17 21:14 ` Daniel Jacobowitz
@ 2005-06-18 8:27 ` Eli Zaretskii
2005-06-18 12:29 ` Bob Rossi
1 sibling, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2005-06-18 8:27 UTC (permalink / raw)
To: gdb-patches
> Date: Fri, 17 Jun 2005 17:14:28 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Fri, Jun 17, 2005 at 05:08:11PM -0400, Bob Rossi wrote:
> > > > - 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.
> >
> > I didn't change this, since there is an alias. However, the more I
> > think about it, it would be fine with me if this was changed to simply
> > 'tty'. Eventually, I might add a console-tty, which is the reason I was
> > more specific with inferior-tty, instead of just tty. What do you think?
>
> Right - what we have now is "tty", this patch preserves "tty" and adds
> "set inferior-tty". Might as well stay with that. It's a little more
> descriptive.
My opinion as well. In any case, the set/show commands should remain
consistent wrt the symmetry between the set and show command. I
suggested to add an alias to "tty" for reasons of backward
compatibility.
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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
1 sibling, 2 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-18 12:29 UTC (permalink / raw)
To: gdb-patches
On Fri, Jun 17, 2005 at 05:14:28PM -0400, Daniel Jacobowitz wrote:
> On Fri, Jun 17, 2005 at 05:08:11PM -0400, Bob Rossi wrote:
> > > > - 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.
> >
> > I didn't change this, since there is an alias. However, the more I
> > think about it, it would be fine with me if this was changed to simply
> > 'tty'. Eventually, I might add a console-tty, which is the reason I was
> > more specific with inferior-tty, instead of just tty. What do you think?
>
> Right - what we have now is "tty", this patch preserves "tty" and adds
> "set inferior-tty". Might as well stay with that. It's a little more
> descriptive.
>
> Could you explain what you've got in mind for console-tty?
Well, I was trying to think of a way to figure out how GDB could create
pty pair's and alert the front end of the filename (device) that it
could use to read from. I figure'd console tty could be a way to tell
GDB what terminal it should be writing it's info that it writes to the
console. Just the same way it does with the inferior.
Another interesting idea to separate the inferior output from the
console output is to have GDB act like valgrind. Simply have GDB output
it's console data to a file descriptor that it recieves on the command
line.
gdb --console-output=10
The the FE could expect to select on descriptor 10 for output from the
console and the standard (stdout) descriptor for output from the inferior.
Although I haven't thought this through much, it could possibly work.
> > I do have one problem with this patch, before it can be approved. There
> > is no file completion for the tty command with the new patch. I can't
> > figure out how to add file completion with the
> > add_setshow_string_noescape_cmd command. Do you or anyone else know how
> > to do this?
>
> If it's a filename, perhaps you should be using
> add_setshow_filename_cmd instead.
OK, Thanks! This works.
Bob Rossi
Index: 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): New function.
+ (get_inferior_io_terminal): Ditto.
+ (tty_command): Use accessor function.
+ (_initialize_infcmd): Add inferior_tty setshow variable.
+ (_initialize_infcmd): Remove tty command.
+ (_initialize_infcmd): Add a tty command that is an alias.
+ * inferior.h (set_inferior_io_terminal): New prototype.
+ (get_inferior_io_terminal): Ditto.
+ (new_tty_prefork): Add const qualifier to parameter.
+ * inflow.c (inferior_thisrun_terminal): Add const qualifier.
+ (new_tty_prefork): Add const qualifier to parameter.
+ * nto-procfs (procfs_create_inferior): Use accessor function.
+ (procfs_create_inferior): Add const qualifier to locals.
+ * win32-nat.c (child_create_inferior): Ditto.
+ * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
+ (mi_cmd_inferior_tty_set): Ditto.
+ * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
+ * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
+ (mi_cmd_inferior_tty_show): Ditto.
Index: gdb/doc/ChangeLog
+ * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
+ and -inferior-tty-show.
+ (Input/Output): Document "set/show inferior-tty" and tty alias.
Index: gdb/testsuite/ChangeLog
+ * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
+ command.
Index: 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
--- gdb/fork-child.c 12 May 2005 20:21:17 -0000 1.26
+++ gdb/fork-child.c 18 Jun 2005 12:21:21 -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. */
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.138
diff -w -u -r1.138 infcmd.c
--- gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
+++ gdb/infcmd.c 18 Jun 2005 12:21:21 -0000
@@ -136,7 +136,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
@@ -203,6 +203,24 @@
\f
/* Accessor routines. */
+void
+set_inferior_io_terminal (const 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)
{
@@ -376,7 +394,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
@@ -1988,11 +2006,15 @@
void
_initialize_infcmd (void)
{
- struct cmd_list_element *c;
+ struct cmd_list_element *c = NULL;
- c = add_com ("tty", class_run, tty_command,
- _("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_filename_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);
+ add_com_alias ("tty", "set inferior-tty", class_alias, 0);
add_setshow_optional_filename_cmd ("args", class_run,
&inferior_args, _("\
Index: gdb/inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.71
diff -w -u -r1.71 inferior.h
--- gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
+++ gdb/inferior.h 18 Jun 2005 12:21:21 -0000
@@ -103,9 +103,10 @@
extern void clear_sigio_trap (void);
-/* File name for default use for standard in/out in the inferior. */
+/* Set/get file name for default use for standard in/out in the inferior. */
-extern char *inferior_io_terminal;
+extern void set_inferior_io_terminal (const 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. */
@@ -264,7 +265,7 @@
/* From inflow.c */
-extern void new_tty_prefork (char *);
+extern void new_tty_prefork (const char *);
extern int gdb_has_a_terminal (void);
Index: gdb/inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.29
diff -w -u -r1.29 inflow.c
--- gdb/inflow.c 15 Feb 2005 15:49:11 -0000 1.29
+++ gdb/inflow.c 18 Jun 2005 12:21:21 -0000
@@ -94,7 +94,7 @@
/* The name of the tty (from the `tty' command) that we gave to the inferior
when it was last started. */
-static char *inferior_thisrun_terminal;
+static const char *inferior_thisrun_terminal;
/* Nonzero if our terminal settings are in effect. Zero if the
inferior's settings are in effect. Ignored if !gdb_has_a_terminal
@@ -509,7 +509,7 @@
the terminal specified in the NEW_TTY_PREFORK call. */
void
-new_tty_prefork (char *ttyname)
+new_tty_prefork (const char *ttyname)
{
/* Save the name for later, for determining whether we and the child
are sharing a tty. */
Index: 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
--- gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
+++ gdb/nto-procfs.c 18 Jun 2005 12:21:21 -0000
@@ -981,9 +981,10 @@
pid_t pid;
int flags, errn;
char **argv, *args;
- char *in = "", *out = "", *err = "";
+ const 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));
Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.111
diff -w -u -r1.111 win32-nat.c
--- gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
+++ gdb/win32-nat.c 18 Jun 2005 12:21:22 -0000
@@ -1735,6 +1735,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: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.261
diff -w -u -r1.261 gdb.texinfo
--- gdb/doc/gdb.texinfo 7 Jun 2005 15:32:38 -0000 1.261
+++ gdb/doc/gdb.texinfo 18 Jun 2005 12:21:32 -0000
@@ -2095,7 +2095,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.
+
+@table @code
+@item set inferior-tty /dev/ttyb
+@kindex set inferior-tty
+Set the tty for the program being debugged to /dev/ttyb.
+
+@item show inferior-tty
+@kindex show inferior-tty
+Show the current tty for the program being debugged.
+@end table
@node Attach
@section Debugging an already-running process
@@ -19134,6 +19151,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 the 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: 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
--- gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
+++ gdb/mi/mi-cmd-env.c 18 Jun 2005 12:21:32 -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: 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
--- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
+++ gdb/mi/mi-cmds.c 18 Jun 2005 12:21:32 -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: 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
--- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
+++ gdb/mi/mi-cmds.h 18 Jun 2005 12:21:32 -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: 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
--- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
+++ gdb/testsuite/gdb.mi/mi-basics.exp 18 Jun 2005 12:21:40 -0000
@@ -236,12 +236,42 @@
}
+proc test_setshow_inferior_tty {} {
+ global mi_gdb_prompt
+
+ # Test that the commands,
+ # -inferior-tty-set
+ # -inferior-tty-show
+ # are setting/getting the same data in GDB.
+
+ 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-06-18 12:29 ` Bob Rossi
@ 2005-06-26 13:43 ` Bob Rossi
2005-07-03 18:43 ` Daniel Jacobowitz
1 sibling, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-06-26 13:43 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
Hi Daniel,
Ping. Thanks for taking the time to review this patch so far.
Bob Rossi
On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> On Fri, Jun 17, 2005 at 05:14:28PM -0400, Daniel Jacobowitz wrote:
> > On Fri, Jun 17, 2005 at 05:08:11PM -0400, Bob Rossi wrote:
> > > > > - 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.
> > >
> > > I didn't change this, since there is an alias. However, the more I
> > > think about it, it would be fine with me if this was changed to simply
> > > 'tty'. Eventually, I might add a console-tty, which is the reason I was
> > > more specific with inferior-tty, instead of just tty. What do you think?
> >
> > Right - what we have now is "tty", this patch preserves "tty" and adds
> > "set inferior-tty". Might as well stay with that. It's a little more
> > descriptive.
> >
> > Could you explain what you've got in mind for console-tty?
>
> Well, I was trying to think of a way to figure out how GDB could create
> pty pair's and alert the front end of the filename (device) that it
> could use to read from. I figure'd console tty could be a way to tell
> GDB what terminal it should be writing it's info that it writes to the
> console. Just the same way it does with the inferior.
>
> Another interesting idea to separate the inferior output from the
> console output is to have GDB act like valgrind. Simply have GDB output
> it's console data to a file descriptor that it recieves on the command
> line.
>
> gdb --console-output=10
>
> The the FE could expect to select on descriptor 10 for output from the
> console and the standard (stdout) descriptor for output from the inferior.
> Although I haven't thought this through much, it could possibly work.
>
> > > I do have one problem with this patch, before it can be approved. There
> > > is no file completion for the tty command with the new patch. I can't
> > > figure out how to add file completion with the
> > > add_setshow_string_noescape_cmd command. Do you or anyone else know how
> > > to do this?
> >
> > If it's a filename, perhaps you should be using
> > add_setshow_filename_cmd instead.
>
> OK, Thanks! This works.
>
> Bob Rossi
>
> Index: 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): New function.
> + (get_inferior_io_terminal): Ditto.
> + (tty_command): Use accessor function.
> + (_initialize_infcmd): Add inferior_tty setshow variable.
> + (_initialize_infcmd): Remove tty command.
> + (_initialize_infcmd): Add a tty command that is an alias.
> + * inferior.h (set_inferior_io_terminal): New prototype.
> + (get_inferior_io_terminal): Ditto.
> + (new_tty_prefork): Add const qualifier to parameter.
> + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> + (new_tty_prefork): Add const qualifier to parameter.
> + * nto-procfs (procfs_create_inferior): Use accessor function.
> + (procfs_create_inferior): Add const qualifier to locals.
> + * win32-nat.c (child_create_inferior): Ditto.
> + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> + (mi_cmd_inferior_tty_set): Ditto.
> + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> + (mi_cmd_inferior_tty_show): Ditto.
>
> Index: gdb/doc/ChangeLog
> + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> + and -inferior-tty-show.
> + (Input/Output): Document "set/show inferior-tty" and tty alias.
>
> Index: gdb/testsuite/ChangeLog
> + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> + command.
>
> Index: 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
> --- gdb/fork-child.c 12 May 2005 20:21:17 -0000 1.26
> +++ gdb/fork-child.c 18 Jun 2005 12:21:21 -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. */
> Index: gdb/infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.138
> diff -w -u -r1.138 infcmd.c
> --- gdb/infcmd.c 22 May 2005 14:53:34 -0000 1.138
> +++ gdb/infcmd.c 18 Jun 2005 12:21:21 -0000
> @@ -136,7 +136,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
> @@ -203,6 +203,24 @@
> \f
> /* Accessor routines. */
>
> +void
> +set_inferior_io_terminal (const 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)
> {
> @@ -376,7 +394,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
> @@ -1988,11 +2006,15 @@
> void
> _initialize_infcmd (void)
> {
> - struct cmd_list_element *c;
> + struct cmd_list_element *c = NULL;
>
> - c = add_com ("tty", class_run, tty_command,
> - _("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_filename_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);
> + add_com_alias ("tty", "set inferior-tty", class_alias, 0);
>
> add_setshow_optional_filename_cmd ("args", class_run,
> &inferior_args, _("\
> Index: gdb/inferior.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/inferior.h,v
> retrieving revision 1.71
> diff -w -u -r1.71 inferior.h
> --- gdb/inferior.h 14 May 2005 06:07:42 -0000 1.71
> +++ gdb/inferior.h 18 Jun 2005 12:21:21 -0000
> @@ -103,9 +103,10 @@
>
> extern void clear_sigio_trap (void);
>
> -/* File name for default use for standard in/out in the inferior. */
> +/* Set/get file name for default use for standard in/out in the inferior. */
>
> -extern char *inferior_io_terminal;
> +extern void set_inferior_io_terminal (const 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. */
> @@ -264,7 +265,7 @@
>
> /* From inflow.c */
>
> -extern void new_tty_prefork (char *);
> +extern void new_tty_prefork (const char *);
>
> extern int gdb_has_a_terminal (void);
>
> Index: gdb/inflow.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/inflow.c,v
> retrieving revision 1.29
> diff -w -u -r1.29 inflow.c
> --- gdb/inflow.c 15 Feb 2005 15:49:11 -0000 1.29
> +++ gdb/inflow.c 18 Jun 2005 12:21:21 -0000
> @@ -94,7 +94,7 @@
> /* The name of the tty (from the `tty' command) that we gave to the inferior
> when it was last started. */
>
> -static char *inferior_thisrun_terminal;
> +static const char *inferior_thisrun_terminal;
>
> /* Nonzero if our terminal settings are in effect. Zero if the
> inferior's settings are in effect. Ignored if !gdb_has_a_terminal
> @@ -509,7 +509,7 @@
> the terminal specified in the NEW_TTY_PREFORK call. */
>
> void
> -new_tty_prefork (char *ttyname)
> +new_tty_prefork (const char *ttyname)
> {
> /* Save the name for later, for determining whether we and the child
> are sharing a tty. */
> Index: 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
> --- gdb/nto-procfs.c 15 Feb 2005 15:49:14 -0000 1.13
> +++ gdb/nto-procfs.c 18 Jun 2005 12:21:21 -0000
> @@ -981,9 +981,10 @@
> pid_t pid;
> int flags, errn;
> char **argv, *args;
> - char *in = "", *out = "", *err = "";
> + const 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));
> Index: gdb/win32-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/win32-nat.c,v
> retrieving revision 1.111
> diff -w -u -r1.111 win32-nat.c
> --- gdb/win32-nat.c 23 May 2005 19:32:27 -0000 1.111
> +++ gdb/win32-nat.c 18 Jun 2005 12:21:22 -0000
> @@ -1735,6 +1735,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: gdb/doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.261
> diff -w -u -r1.261 gdb.texinfo
> --- gdb/doc/gdb.texinfo 7 Jun 2005 15:32:38 -0000 1.261
> +++ gdb/doc/gdb.texinfo 18 Jun 2005 12:21:32 -0000
> @@ -2095,7 +2095,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.
> +
> +@table @code
> +@item set inferior-tty /dev/ttyb
> +@kindex set inferior-tty
> +Set the tty for the program being debugged to /dev/ttyb.
> +
> +@item show inferior-tty
> +@kindex show inferior-tty
> +Show the current tty for the program being debugged.
> +@end table
>
> @node Attach
> @section Debugging an already-running process
> @@ -19134,6 +19151,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 the 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: 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
> --- gdb/mi/mi-cmd-env.c 11 Feb 2005 04:06:11 -0000 1.8
> +++ gdb/mi/mi-cmd-env.c 18 Jun 2005 12:21:32 -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: 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
> --- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
> +++ gdb/mi/mi-cmds.c 18 Jun 2005 12:21:32 -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: 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
> --- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
> +++ gdb/mi/mi-cmds.h 18 Jun 2005 12:21:32 -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: 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
> --- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
> +++ gdb/testsuite/gdb.mi/mi-basics.exp 18 Jun 2005 12:21:40 -0000
> @@ -236,12 +236,42 @@
>
> }
>
> +proc test_setshow_inferior_tty {} {
> + global mi_gdb_prompt
> +
> + # Test that the commands,
> + # -inferior-tty-set
> + # -inferior-tty-show
> + # are setting/getting the same data in GDB.
> +
> + 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
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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
1 sibling, 1 reply; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-07-03 18:43 UTC (permalink / raw)
To: gdb-patches
On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> Index: 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): New function.
> + (get_inferior_io_terminal): Ditto.
> + (tty_command): Use accessor function.
> + (_initialize_infcmd): Add inferior_tty setshow variable.
> + (_initialize_infcmd): Remove tty command.
> + (_initialize_infcmd): Add a tty command that is an alias.
> + * inferior.h (set_inferior_io_terminal): New prototype.
> + (get_inferior_io_terminal): Ditto.
> + (new_tty_prefork): Add const qualifier to parameter.
> + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> + (new_tty_prefork): Add const qualifier to parameter.
> + * nto-procfs (procfs_create_inferior): Use accessor function.
> + (procfs_create_inferior): Add const qualifier to locals.
> + * win32-nat.c (child_create_inferior): Ditto.
> + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> + (mi_cmd_inferior_tty_set): Ditto.
> + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> + (mi_cmd_inferior_tty_show): Ditto.
>
> Index: gdb/doc/ChangeLog
> + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> + and -inferior-tty-show.
> + (Input/Output): Document "set/show inferior-tty" and tty alias.
>
> Index: gdb/testsuite/ChangeLog
> + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> + command.
This is almost completely OK now! Two minor fixes:
> Index: 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
> --- gdb/mi/mi-cmds.c 11 Feb 2005 18:13:55 -0000 1.16
> +++ gdb/mi/mi-cmds.c 18 Jun 2005 12:21:32 -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: 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
> --- gdb/mi/mi-cmds.h 13 Jan 2005 22:08:27 -0000 1.15
> +++ gdb/mi/mi-cmds.h 18 Jun 2005 12:21:32 -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;
At some point the commant must have been named -tty-set, because then
these lists would be nicely alphabetized :-) Please put these in the
right place.
> Index: 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
> --- gdb/testsuite/gdb.mi/mi-basics.exp 9 Aug 2004 16:32:44 -0000 1.9
> +++ gdb/testsuite/gdb.mi/mi-basics.exp 18 Jun 2005 12:21:40 -0000
Missing a copyright year update.
Feel free to check it in with those changes.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-03 18:43 ` Daniel Jacobowitz
@ 2005-07-06 14:54 ` Bob Rossi
2005-07-10 21:08 ` Mark Kettenis
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-07-06 14:54 UTC (permalink / raw)
To: gdb-patches
On Sun, Jul 03, 2005 at 02:43:25PM -0400, Daniel Jacobowitz wrote:
> On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> > Index: 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): New function.
> > + (get_inferior_io_terminal): Ditto.
> > + (tty_command): Use accessor function.
> > + (_initialize_infcmd): Add inferior_tty setshow variable.
> > + (_initialize_infcmd): Remove tty command.
> > + (_initialize_infcmd): Add a tty command that is an alias.
> > + * inferior.h (set_inferior_io_terminal): New prototype.
> > + (get_inferior_io_terminal): Ditto.
> > + (new_tty_prefork): Add const qualifier to parameter.
> > + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> > + (new_tty_prefork): Add const qualifier to parameter.
> > + * nto-procfs (procfs_create_inferior): Use accessor function.
> > + (procfs_create_inferior): Add const qualifier to locals.
> > + * win32-nat.c (child_create_inferior): Ditto.
> > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> > + (mi_cmd_inferior_tty_set): Ditto.
> > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> > + (mi_cmd_inferior_tty_show): Ditto.
> >
> > Index: gdb/doc/ChangeLog
> > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> > + and -inferior-tty-show.
> > + (Input/Output): Document "set/show inferior-tty" and tty alias.
> >
> > Index: gdb/testsuite/ChangeLog
> > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > + command.
>
> This is almost completely OK now! Two minor fixes:
Thanks very much! Committed. Now the interesting patches are coming :)
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-06 14:54 ` Bob Rossi
@ 2005-07-10 21:08 ` Mark Kettenis
2005-07-10 21:32 ` Bob Rossi
` (2 more replies)
0 siblings, 3 replies; 49+ messages in thread
From: Mark Kettenis @ 2005-07-10 21:08 UTC (permalink / raw)
To: bob; +Cc: gdb-patches
Date: Wed, 6 Jul 2005 10:54:49 -0400
From: Bob Rossi <bob@brasko.net>
On Sun, Jul 03, 2005 at 02:43:25PM -0400, Daniel Jacobowitz wrote:
> On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> > Index: 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): New function.
> > + (get_inferior_io_terminal): Ditto.
> > + (tty_command): Use accessor function.
> > + (_initialize_infcmd): Add inferior_tty setshow variable.
> > + (_initialize_infcmd): Remove tty command.
> > + (_initialize_infcmd): Add a tty command that is an alias.
> > + * inferior.h (set_inferior_io_terminal): New prototype.
> > + (get_inferior_io_terminal): Ditto.
> > + (new_tty_prefork): Add const qualifier to parameter.
> > + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> > + (new_tty_prefork): Add const qualifier to parameter.
> > + * nto-procfs (procfs_create_inferior): Use accessor function.
> > + (procfs_create_inferior): Add const qualifier to locals.
> > + * win32-nat.c (child_create_inferior): Ditto.
> > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> > + (mi_cmd_inferior_tty_set): Ditto.
> > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> > + (mi_cmd_inferior_tty_show): Ditto.
> >
> > Index: gdb/doc/ChangeLog
> > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> > + and -inferior-tty-show.
> > + (Input/Output): Document "set/show inferior-tty" and tty alias.
> >
> > Index: gdb/testsuite/ChangeLog
> > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > + command.
>
> This is almost completely OK now! Two minor fixes:
Thanks very much! Committed. Now the interesting patches are coming :)
Bob, please make sure there are no regressions from your patch before
you check things in. I now get:
FAIL: gdb.base/default.exp: tty
FAIL: gdb.base/help.exp: help tty
because the output of the tty command changed. In the past we had:
(gdb) tty
Argument required (terminal name for running target process).
whereas now we have
(gdb) tty
Argument required (filename to set it to.).
I don't really consider this an improvement...
Mark
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-10 21:08 ` Mark Kettenis
@ 2005-07-10 21:32 ` Bob Rossi
2005-07-11 15:52 ` Bob Rossi
2005-07-11 21:26 ` Bob Rossi
2 siblings, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-07-10 21:32 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Sun, Jul 10, 2005 at 11:08:12PM +0200, Mark Kettenis wrote:
> Date: Wed, 6 Jul 2005 10:54:49 -0400
> From: Bob Rossi <bob@brasko.net>
>
> On Sun, Jul 03, 2005 at 02:43:25PM -0400, Daniel Jacobowitz wrote:
> > On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> > > Index: 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): New function.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (tty_command): Use accessor function.
> > > + (_initialize_infcmd): Add inferior_tty setshow variable.
> > > + (_initialize_infcmd): Remove tty command.
> > > + (_initialize_infcmd): Add a tty command that is an alias.
> > > + * inferior.h (set_inferior_io_terminal): New prototype.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * nto-procfs (procfs_create_inferior): Use accessor function.
> > > + (procfs_create_inferior): Add const qualifier to locals.
> > > + * win32-nat.c (child_create_inferior): Ditto.
> > > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> > > + (mi_cmd_inferior_tty_set): Ditto.
> > > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> > > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> > > + (mi_cmd_inferior_tty_show): Ditto.
> > >
> > > Index: gdb/doc/ChangeLog
> > > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> > > + and -inferior-tty-show.
> > > + (Input/Output): Document "set/show inferior-tty" and tty alias.
> > >
> > > Index: gdb/testsuite/ChangeLog
> > > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > > + command.
> >
> > This is almost completely OK now! Two minor fixes:
>
> Thanks very much! Committed. Now the interesting patches are coming :)
>
> Bob, please make sure there are no regressions from your patch before
> you check things in. I now get:
>
> FAIL: gdb.base/default.exp: tty
> FAIL: gdb.base/help.exp: help tty
>
> because the output of the tty command changed. In the past we had:
>
> (gdb) tty
> Argument required (terminal name for running target process).
>
> whereas now we have
>
> (gdb) tty
> Argument required (filename to set it to.).
>
> I don't really consider this an improvement...
Mark, very very sorry. I ran the testsuite before I made 'tty' an alias.
I'll fix this, and it won't happen again.
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
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 21:26 ` Bob Rossi
2 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-07-11 15:52 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Sun, Jul 10, 2005 at 11:08:12PM +0200, Mark Kettenis wrote:
> Date: Wed, 6 Jul 2005 10:54:49 -0400
> From: Bob Rossi <bob@brasko.net>
>
> On Sun, Jul 03, 2005 at 02:43:25PM -0400, Daniel Jacobowitz wrote:
> > On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> > > Index: 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): New function.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (tty_command): Use accessor function.
> > > + (_initialize_infcmd): Add inferior_tty setshow variable.
> > > + (_initialize_infcmd): Remove tty command.
> > > + (_initialize_infcmd): Add a tty command that is an alias.
> > > + * inferior.h (set_inferior_io_terminal): New prototype.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * nto-procfs (procfs_create_inferior): Use accessor function.
> > > + (procfs_create_inferior): Add const qualifier to locals.
> > > + * win32-nat.c (child_create_inferior): Ditto.
> > > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> > > + (mi_cmd_inferior_tty_set): Ditto.
> > > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> > > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> > > + (mi_cmd_inferior_tty_show): Ditto.
> > >
> > > Index: gdb/doc/ChangeLog
> > > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> > > + and -inferior-tty-show.
> > > + (Input/Output): Document "set/show inferior-tty" and tty alias.
> > >
> > > Index: gdb/testsuite/ChangeLog
> > > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > > + command.
> >
> > This is almost completely OK now! Two minor fixes:
>
> Thanks very much! Committed. Now the interesting patches are coming :)
>
> Bob, please make sure there are no regressions from your patch before
> you check things in. I now get:
>
> FAIL: gdb.base/default.exp: tty
> FAIL: gdb.base/help.exp: help tty
>
> because the output of the tty command changed. In the past we had:
>
> (gdb) tty
> Argument required (terminal name for running target process).
>
> whereas now we have
>
> (gdb) tty
> Argument required (filename to set it to.).
>
> I don't really consider this an improvement...
Does anyone know why the "tty" command gives the "default" message when
I have,
/* add the filename of the terminal connected to inferior I/O */
add_setshow_filename_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);
add_com_alias ("tty", "set inferior-tty", class_alias, 0);
I would expect the alias to take on the usage note from the command it
points to. Either that, or allow me to explicitly give it a usage note.
Any suggestions?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 15:52 ` Bob Rossi
@ 2005-07-11 18:41 ` Mark Kettenis
2005-07-11 20:00 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Mark Kettenis @ 2005-07-11 18:41 UTC (permalink / raw)
To: bob; +Cc: gdb-patches
Date: Mon, 11 Jul 2005 11:51:55 -0400
From: Bob Rossi <bob@brasko.net>
> Bob, please make sure there are no regressions from your patch before
> you check things in. I now get:
>
> FAIL: gdb.base/default.exp: tty
> FAIL: gdb.base/help.exp: help tty
>
> because the output of the tty command changed. In the past we had:
>
> (gdb) tty
> Argument required (terminal name for running target process).
>
> whereas now we have
>
> (gdb) tty
> Argument required (filename to set it to.).
>
> I don't really consider this an improvement...
Does anyone know why the "tty" command gives the "default" message when
I have,
/* add the filename of the terminal connected to inferior I/O */
add_setshow_filename_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);
add_com_alias ("tty", "set inferior-tty", class_alias, 0);
I would expect the alias to take on the usage note from the command it
points to. Either that, or allow me to explicitly give it a usage note.
Any suggestions?
But it does take the usage nore from the command it points to:
(gdb) set inferior-tty
Argument required (filename to set it to.).
Mark
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 18:41 ` Mark Kettenis
@ 2005-07-11 20:00 ` Bob Rossi
2005-07-11 20:01 ` Daniel Jacobowitz
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-07-11 20:00 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Mon, Jul 11, 2005 at 08:40:50PM +0200, Mark Kettenis wrote:
> Date: Mon, 11 Jul 2005 11:51:55 -0400
> From: Bob Rossi <bob@brasko.net>
>
> > Bob, please make sure there are no regressions from your patch before
> > you check things in. I now get:
> >
> > FAIL: gdb.base/default.exp: tty
> > FAIL: gdb.base/help.exp: help tty
> >
> > because the output of the tty command changed. In the past we had:
> >
> > (gdb) tty
> > Argument required (terminal name for running target process).
> >
> > whereas now we have
> >
> > (gdb) tty
> > Argument required (filename to set it to.).
> >
> > I don't really consider this an improvement...
>
> Does anyone know why the "tty" command gives the "default" message when
> I have,
>
> /* add the filename of the terminal connected to inferior I/O */
> add_setshow_filename_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);
>
> add_com_alias ("tty", "set inferior-tty", class_alias, 0);
>
> I would expect the alias to take on the usage note from the command it
> points to. Either that, or allow me to explicitly give it a usage note.
> Any suggestions?
>
> But it does take the usage nore from the command it points to:
>
> (gdb) set inferior-tty
> Argument required (filename to set it to.).
Whoa, OK. I just realized that add_setshow_filename_cmd is borked.
The "set_doc" doesn't work, but the "show_doc" does.
Look at this command (which I had nothing to do with),
add_setshow_filename_cmd ("remotelogfile", no_class,
&serial_logfile, _("\
Set filename for remote session recording."), _("\
Show filename for remote session recording."), _("\
This file is used to record the remote session for future
playback\n\
by gdbserver."), ...
(gdb) set remotelogfile
Argument required (filename to set it to.).
(gdb) show remotelogfile
Filename for remote session recording is "".
I'll look into this.
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 20:00 ` Bob Rossi
@ 2005-07-11 20:01 ` Daniel Jacobowitz
2005-07-11 20:44 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Daniel Jacobowitz @ 2005-07-11 20:01 UTC (permalink / raw)
To: Mark Kettenis, gdb-patches
On Mon, Jul 11, 2005 at 04:00:11PM -0400, Bob Rossi wrote:
> Whoa, OK. I just realized that add_setshow_filename_cmd is borked.
> The "set_doc" doesn't work, but the "show_doc" does.
>
> Look at this command (which I had nothing to do with),
>
> add_setshow_filename_cmd ("remotelogfile", no_class,
> &serial_logfile, _("\
> Set filename for remote session recording."), _("\
> Show filename for remote session recording."), _("\
> This file is used to record the remote session for future
> playback\n\
> by gdbserver."), ...
>
> (gdb) set remotelogfile
> Argument required (filename to set it to.).
> (gdb) show remotelogfile
> Filename for remote session recording is "".
>
> I'll look into this.
No, there are three docs:
help set inferior-tty
help show inferior-tty
set inferior-tty
Mark's complaining about the third of the batch. Personally, I think
it's not much of a loss.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 20:01 ` Daniel Jacobowitz
@ 2005-07-11 20:44 ` Bob Rossi
2005-07-11 20:55 ` Mark Kettenis
0 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-07-11 20:44 UTC (permalink / raw)
To: Mark Kettenis, gdb-patches
On Mon, Jul 11, 2005 at 04:01:39PM -0400, Daniel Jacobowitz wrote:
> On Mon, Jul 11, 2005 at 04:00:11PM -0400, Bob Rossi wrote:
> > Whoa, OK. I just realized that add_setshow_filename_cmd is borked.
> > The "set_doc" doesn't work, but the "show_doc" does.
> >
> > Look at this command (which I had nothing to do with),
> >
> > add_setshow_filename_cmd ("remotelogfile", no_class,
> > &serial_logfile, _("\
> > Set filename for remote session recording."), _("\
> > Show filename for remote session recording."), _("\
> > This file is used to record the remote session for future
> > playback\n\
> > by gdbserver."), ...
> >
> > (gdb) set remotelogfile
> > Argument required (filename to set it to.).
> > (gdb) show remotelogfile
> > Filename for remote session recording is "".
> >
> > I'll look into this.
>
> No, there are three docs:
> help set inferior-tty
> help show inferior-tty
> set inferior-tty
>
> Mark's complaining about the third of the batch. Personally, I think
> it's not much of a loss.
O, I see now. Mark, with that said, I think the output is correct,
although I still need to fix the regressions's. Do you agree with this?
(gdb) help set inferior-tty
Set terminal for future runs of program being debugged.
Usage: set inferior-tty /dev/pts/1
(gdb) help show inferior-tty
Show terminal for future runs of program being debugged.
Usage: set inferior-tty /dev/pts/1
(gdb) set inferior-tty
Argument required (filename to set it to.).
(gdb) show inferior-tty
Terminal for future runs of program being debugged is "".
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 20:44 ` Bob Rossi
@ 2005-07-11 20:55 ` Mark Kettenis
0 siblings, 0 replies; 49+ messages in thread
From: Mark Kettenis @ 2005-07-11 20:55 UTC (permalink / raw)
To: bob; +Cc: gdb-patches
Date: Mon, 11 Jul 2005 16:44:14 -0400
From: Bob Rossi <bob@brasko.net>
On Mon, Jul 11, 2005 at 04:01:39PM -0400, Daniel Jacobowitz wrote:
> On Mon, Jul 11, 2005 at 04:00:11PM -0400, Bob Rossi wrote:
> > Whoa, OK. I just realized that add_setshow_filename_cmd is borked.
> > The "set_doc" doesn't work, but the "show_doc" does.
> >
> > Look at this command (which I had nothing to do with),
> >
> > add_setshow_filename_cmd ("remotelogfile", no_class,
> > &serial_logfile, _("\
> > Set filename for remote session recording."), _("\
> > Show filename for remote session recording."), _("\
> > This file is used to record the remote session for future
> > playback\n\
> > by gdbserver."), ...
> >
> > (gdb) set remotelogfile
> > Argument required (filename to set it to.).
> > (gdb) show remotelogfile
> > Filename for remote session recording is "".
> >
> > I'll look into this.
>
> No, there are three docs:
> help set inferior-tty
> help show inferior-tty
> set inferior-tty
>
> Mark's complaining about the third of the batch. Personally, I think
> it's not much of a loss.
O, I see now. Mark, with that said, I think the output is correct,
although I still need to fix the regressions's. Do you agree with this?
(gdb) help set inferior-tty
Set terminal for future runs of program being debugged.
Usage: set inferior-tty /dev/pts/1
(gdb) help show inferior-tty
Show terminal for future runs of program being debugged.
Usage: set inferior-tty /dev/pts/1
(gdb) set inferior-tty
Argument required (filename to set it to.).
Well, I think the previous message in this case was a bit more
helpful, but I can't say I really care that much. So go ahead and fix
the testsuite ;-).
(gdb) show inferior-tty
Terminal for future runs of program being debugged is "".
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-10 21:08 ` Mark Kettenis
2005-07-10 21:32 ` Bob Rossi
2005-07-11 15:52 ` Bob Rossi
@ 2005-07-11 21:26 ` Bob Rossi
2005-07-12 20:56 ` Mark Kettenis
2 siblings, 1 reply; 49+ messages in thread
From: Bob Rossi @ 2005-07-11 21:26 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Sun, Jul 10, 2005 at 11:08:12PM +0200, Mark Kettenis wrote:
> Date: Wed, 6 Jul 2005 10:54:49 -0400
> From: Bob Rossi <bob@brasko.net>
>
> On Sun, Jul 03, 2005 at 02:43:25PM -0400, Daniel Jacobowitz wrote:
> > On Sat, Jun 18, 2005 at 08:29:21AM -0400, Bob Rossi wrote:
> > > Index: 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): New function.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (tty_command): Use accessor function.
> > > + (_initialize_infcmd): Add inferior_tty setshow variable.
> > > + (_initialize_infcmd): Remove tty command.
> > > + (_initialize_infcmd): Add a tty command that is an alias.
> > > + * inferior.h (set_inferior_io_terminal): New prototype.
> > > + (get_inferior_io_terminal): Ditto.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * inflow.c (inferior_thisrun_terminal): Add const qualifier.
> > > + (new_tty_prefork): Add const qualifier to parameter.
> > > + * nto-procfs (procfs_create_inferior): Use accessor function.
> > > + (procfs_create_inferior): Add const qualifier to locals.
> > > + * win32-nat.c (child_create_inferior): Ditto.
> > > + * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): New function.
> > > + (mi_cmd_inferior_tty_set): Ditto.
> > > + * mi/mi-cmds.c (mi_cmds): Add inferior-tty-set and inferior-tty-show
> > > + * mi/mi-cmds.h (mi_cmd_inferior_tty_set): Add prototype.
> > > + (mi_cmd_inferior_tty_show): Ditto.
> > >
> > > Index: gdb/doc/ChangeLog
> > > + * gdb.texinfo (GDB/MI Miscellaneous Commands): Add -inferior-tty-set
> > > + and -inferior-tty-show.
> > > + (Input/Output): Document "set/show inferior-tty" and tty alias.
> > >
> > > Index: gdb/testsuite/ChangeLog
> > > + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty
> > > + command.
> >
> > This is almost completely OK now! Two minor fixes:
>
> Thanks very much! Committed. Now the interesting patches are coming :)
>
> Bob, please make sure there are no regressions from your patch before
> you check things in. I now get:
>
> FAIL: gdb.base/default.exp: tty
> FAIL: gdb.base/help.exp: help tty
This patch fixes both the regressions and breaks nothing else.
OK to Commit?
2005-07-11 Bob Rossi <bob@brasko.net>
* gdb.base/default.exp (tty): Changed output of command.
* gdb.base/help.exp (help tty): Ditto.
Thanks,
Bob Rossi
Index: gdb/testsuite/gdb.base/default.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v
retrieving revision 1.17
diff -u -r1.17 default.exp
--- gdb/testsuite/gdb.base/default.exp 20 Mar 2003 14:45:50 -0000 1.17
+++ gdb/testsuite/gdb.base/default.exp 11 Jul 2005 21:21:16 -0000
@@ -754,7 +754,7 @@
#test tbreak
gdb_test "tbreak" "No default breakpoint address now." "tbreak"
#test tty
-gdb_test "tty" "Argument required .terminal name for running target process.*" "tty"
+gdb_test "tty" "Argument required .filename to set it to\..*" "tty"
#test until "u" abbreviation
gdb_test "u" "The program is not running." "until \"u\" abbreviation"
#test until
Index: gdb/testsuite/gdb.base/help.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/help.exp,v
retrieving revision 1.14
diff -u -r1.14 help.exp
--- gdb/testsuite/gdb.base/help.exp 20 Mar 2003 14:19:41 -0000 1.14
+++ gdb/testsuite/gdb.base/help.exp 11 Jul 2005 21:21:17 -0000
@@ -562,7 +562,7 @@
# test help tbreak
gdb_test "help tbreak" "Set a temporary breakpoint.*" "help tbreak"
# test help tty
-gdb_test "help tty" "Set terminal for future runs of program being debugged\." "help tty"
+gdb_test "help tty" "Set terminal for future runs of program being debugged\.\[\r\n\]+Usage: set inferior-tty /dev/pts/1" "help tty"
# test help until "u" abbreviation
gdb_test "help u" "Execute until the program reaches a source line greater than the current\[\r\n\]+or a specified location \\(same args as break command\\) within the current frame\." "help until \"u\" abbreviation"
# test help until
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-11 21:26 ` Bob Rossi
@ 2005-07-12 20:56 ` Mark Kettenis
2005-07-14 14:51 ` Bob Rossi
0 siblings, 1 reply; 49+ messages in thread
From: Mark Kettenis @ 2005-07-12 20:56 UTC (permalink / raw)
To: bob; +Cc: gdb-patches
Date: Mon, 11 Jul 2005 17:26:24 -0400
From: Bob Rossi <bob@brasko.net>
This patch fixes both the regressions and breaks nothing else.
OK to Commit?
This is OK.
Mark
2005-07-11 Bob Rossi <bob@brasko.net>
* gdb.base/default.exp (tty): Changed output of command.
* gdb.base/help.exp (help tty): Ditto.
Thanks,
Bob Rossi
Index: gdb/testsuite/gdb.base/default.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v
retrieving revision 1.17
diff -u -r1.17 default.exp
--- gdb/testsuite/gdb.base/default.exp 20 Mar 2003 14:45:50 -0000 1.17
+++ gdb/testsuite/gdb.base/default.exp 11 Jul 2005 21:21:16 -0000
@@ -754,7 +754,7 @@
#test tbreak
gdb_test "tbreak" "No default breakpoint address now." "tbreak"
#test tty
-gdb_test "tty" "Argument required .terminal name for running target process.*" "tty"
+gdb_test "tty" "Argument required .filename to set it to\..*" "tty"
#test until "u" abbreviation
gdb_test "u" "The program is not running." "until \"u\" abbreviation"
#test until
Index: gdb/testsuite/gdb.base/help.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/help.exp,v
retrieving revision 1.14
diff -u -r1.14 help.exp
--- gdb/testsuite/gdb.base/help.exp 20 Mar 2003 14:19:41 -0000 1.14
+++ gdb/testsuite/gdb.base/help.exp 11 Jul 2005 21:21:17 -0000
@@ -562,7 +562,7 @@
# test help tbreak
gdb_test "help tbreak" "Set a temporary breakpoint.*" "help tbreak"
# test help tty
-gdb_test "help tty" "Set terminal for future runs of program being debugged\." "help tty"
+gdb_test "help tty" "Set terminal for future runs of program being debugged\.\[\r\n\]+Usage: set inferior-tty /dev/pts/1" "help tty"
# test help until "u" abbreviation
gdb_test "help u" "Execute until the program reaches a source line greater than the current\[\r\n\]+or a specified location \\(same args as break command\\) within the current frame\." "help until \"u\" abbreviation"
# test help until
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: mi tty commands
2005-07-12 20:56 ` Mark Kettenis
@ 2005-07-14 14:51 ` Bob Rossi
0 siblings, 0 replies; 49+ messages in thread
From: Bob Rossi @ 2005-07-14 14:51 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Tue, Jul 12, 2005 at 10:56:07PM +0200, Mark Kettenis wrote:
> Date: Mon, 11 Jul 2005 17:26:24 -0400
> From: Bob Rossi <bob@brasko.net>
>
> This patch fixes both the regressions and breaks nothing else.
> OK to Commit?
>
> This is OK.
>
> Mark
Committed.
Bob Rossi
^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2005-07-14 14:51 UTC | newest]
Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-24 20:49 mi tty commands 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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox