This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Allow resetting an empty inferior-tty
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Wed, 24 Aug 2016 16:33:10 +0100
- Subject: Re: [PATCH] Allow resetting an empty inferior-tty
- Authentication-results: sourceware.org; auth=none
- References: <20160824144548.19204-1-simon.marchi@ericsson.com>
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