From 139d8e7ccc24e0efaa84ad9424f318d55dfe9eea Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 1 Jul 2016 21:23:28 -0400 Subject: [PATCH] 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. --- gdb/infcmd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 58ba1cb..97a1e35 100644 --- a/gdb/infcmd.c +++ b/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 && strlen (terminal_name) > 0) + current_inferior ()->terminal = xstrdup (terminal_name); + else + current_inferior ()->terminal = NULL; } const char * @@ -3224,14 +3228,14 @@ _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); + set_inferior_tty_command, + show_inferior_tty_command, + &setlist, &showlist); add_com_alias ("tty", "set inferior-tty", class_alias, 0); cmd_name = "args"; -- 2.9.0