This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow resetting an empty inferior-tty


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]