aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorBob Rossi <bob@brasko.net>2005-07-06 14:54:37 +0000
committerBob Rossi <bob@brasko.net>2005-07-06 14:54:37 +0000
commit3cb3b8dfd1975f480bec3ebd8023f1cc8351606d (patch)
tree4343381252723a8129f84a7e1b8ff55db8a77469 /gdb/infcmd.c
parent5cf2e3f01e6546edc8951532cfeaebef5587fba4 (diff)
downloadgdb-3cb3b8dfd1975f480bec3ebd8023f1cc8351606d.zip
gdb-3cb3b8dfd1975f480bec3ebd8023f1cc8351606d.tar.gz
gdb-3cb3b8dfd1975f480bec3ebd8023f1cc8351606d.tar.bz2
Index: gdb/ChangeLog
+2005-07-06 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): 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 +2005-07-06 Bob Rossi <bob@brasko.net> + + * 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 +2005-07-06 Bob Rossi <bob@brasko.net> + + * gdb.mi/mi-basics.exp (test_setshow_inferior_tty): Test MI tty + command. + (Copyright): Update copyright.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 86e8d9d..dff889f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -136,7 +136,7 @@ static char **inferior_argv;
/* 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 @@ struct gdb_environ *inferior_environ;
/* 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 @@ tty_command (char *file, int from_tty)
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 @@ unset_command (char *args, int from_tty)
void
_initialize_infcmd (void)
{
- struct cmd_list_element *c;
-
- c = add_com ("tty", class_run, tty_command,
- _("Set terminal for future runs of program being debugged."));
- set_cmd_completer (c, filename_completer);
+ struct cmd_list_element *c = NULL;
+
+ /* 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, _("\