Allow resetting an empty inferior-tty
This patch allows the user to set the inferior-tty to "empty", in order to come back to the default behaviour of using the same tty as gdb is using. This is already supported in MI (and tested in gdb.mi/mi-basics.exp). I added a new test, set-inferior-tty.exp, where I test only the setting and unsetting of the parameter. It would be nice to actually test that the inferior output properly goes to the separate tty, but that will be for another day. gdb/ChangeLog: * infcmd.c (set_inferior_io_terminal): Set inferior terminal to NULL if terminal_name is an empty string. (_initialize_infcmd): Make the argument of "set inferior-tty" optional, mention it in the help doc. gdb/doc/ChangeLog: * gdb.texinfo (Input/Output): Mention possibility to unset inferior-tty. gdb/testsuite/ChangeLog: * gdb.base/set-inferior-tty.exp: New file. * gdb.base/set-inferior-tty.c: New file.
This commit is contained in:
parent
bdd78711b4
commit
0a1ddfa6b6
7 changed files with 98 additions and 9 deletions
20
gdb/infcmd.c
20
gdb/infcmd.c
|
@ -151,7 +151,11 @@ void
|
|||
set_inferior_io_terminal (const char *terminal_name)
|
||||
{
|
||||
xfree (current_inferior ()->terminal);
|
||||
current_inferior ()->terminal = terminal_name ? xstrdup (terminal_name) : 0;
|
||||
|
||||
if (terminal_name != NULL && *terminal_name != '\0')
|
||||
current_inferior ()->terminal = xstrdup (terminal_name);
|
||||
else
|
||||
current_inferior ()->terminal = NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -3224,14 +3228,16 @@ _initialize_infcmd (void)
|
|||
const char *cmd_name;
|
||||
|
||||
/* Add the filename of the terminal connected to inferior I/O. */
|
||||
add_setshow_filename_cmd ("inferior-tty", class_run,
|
||||
&inferior_io_terminal_scratch, _("\
|
||||
add_setshow_optional_filename_cmd ("inferior-tty", class_run,
|
||||
&inferior_io_terminal_scratch, _("\
|
||||
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"),
|
||||
set_inferior_tty_command,
|
||||
show_inferior_tty_command,
|
||||
&setlist, &showlist);
|
||||
Usage: set inferior-tty [TTY]\n\n\
|
||||
If TTY is omitted, the default behavior of using the same terminal as GDB\n\
|
||||
is restored."),
|
||||
set_inferior_tty_command,
|
||||
show_inferior_tty_command,
|
||||
&setlist, &showlist);
|
||||
add_com_alias ("tty", "set inferior-tty", class_alias, 0);
|
||||
|
||||
cmd_name = "args";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue