[PATCH] Allow resetting an empty inferior-tty
Pedro Alves
palves@redhat.com
Wed Aug 24 15:33:00 GMT 2016
On 08/24/2016 03:45 PM, Simon Marchi wrote:
> 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.
LGTM. A couple nits below.
> 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)
Use th idiomatic empty-string check: *terminal_name != '\0'
> /* 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"),
Should we update the online help too?
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list