Re: [PATCH v8 2/6] gdb, cli: remove left-over code from "set_logging_on".

Andrew Burgess <[email protected]> Wed, 22 Jul 2026 20:13:42 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Thanks for this clean up.  One minor comment inline below.

Klaus Gerlicher <[email protected]> writes:

> From: Natalia Saiapova <[email protected]>
>
> This is a refactoring.  Remove the left-over code, which rewrites
> the logging filename in "set logging on" command.
>
> The code became unused after the deprecation of "set logging (on|off)"
> command.  Before the deprecation, the command could also take a file
> name and rewrite the logging file, e.g.:
>   (gdb) set logging on lalala
>   Copying output to lalala.
>   Copying debug output to lalala.
>
> After the command was deprecated and reimplemented as an alias to "set
> logging enable on", additional input after "on" became invalid:

Here and in two additional places below you say 'enable' instead of
'enabled'.  I know 'enable' works fine due to prefix matching, but for
commit messages I think it's best to be accurate.

With that fixed:

Approved-By: Andrew Burgess <[email protected]>

Thanks,
Andrew

>
>   (gdb) set logging on lalala
>   Warning: 'set logging on', an alias for the command 'set logging enabled', is deprecated.
>   Use 'set logging enabled on'.
>
>   "on" or "off" expected.
>   (gdb) set logging on lalala
>   "on" or "off" expected.
>   (gdb) set logging enable on lalala
>   "on" or "off" expected.
>   (gdb) set logging enable on
>   Copying output to gdb.txt.
>   Copying debug output to gdb.txt.
> ---
>  gdb/cli/cli-logging.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
> index c9482d59199..33bb42bb444 100644
> --- a/gdb/cli/cli-logging.c
> +++ b/gdb/cli/cli-logging.c
> @@ -270,11 +270,6 @@ handle_redirections (int from_tty)
>  static void
>  set_logging_on (const char *args, int from_tty)
>  {
> -  const char *rest = args;
> -
> -  if (rest && *rest)
> -    logging_filename = rest;
> -
>    handle_redirections (from_tty);
>  }
>  
> -- 
> 2.34.1
>
> Intel Deutschland GmbH
>
> Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
> Tel: +49 89 991 430, www.intel.de
> Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Seat: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928