public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Lancelot SIX <lsix@lancelotsix.com>
Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH] [gdb/cli] Add command: show logging active
Date: Wed, 24 Nov 2021 11:31:42 +0100	[thread overview]
Message-ID: <a1b7256c-63d5-f9dd-63ae-8030314a53d4@suse.de> (raw)
In-Reply-To: <20211123123041.hbq4e5fc22g7gab7@ubuntu.lan>

On 11/23/21 1:30 PM, Lancelot SIX wrote:
>>> ---
>>>  gdb/NEWS              |  5 +++++
>>>  gdb/cli/cli-logging.c | 13 +++++++++++++
>>>  gdb/doc/gdb.texinfo   |  2 ++
>>>  3 files changed, 20 insertions(+)
>>>
>>> diff --git a/gdb/NEWS b/gdb/NEWS
>>> index 9e950d2f80d..253070a2a57 100644
>>> --- a/gdb/NEWS
>>> +++ b/gdb/NEWS
>>> @@ -32,6 +32,11 @@ maint show internal-warning backtrace
>>>    internal-error, or an internal-warning.  This is on by default for
>>>    internal-error and off by default for internal-warning.
>>>  
>>> +show logging active
>>> +  This command shows whether logging is enabled or disabled.  Whether logging
>>> +  is enabled or disabled is controlled by pre-existing command
>>> +  "set logging [on|off]".
>>> +
>>>  * Python API
>>>  
>>>    ** New function gdb.add_history(), which takes a gdb.Value object
>>> diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
>>> index f0ee09180f9..081afcc4ca2 100644
>>> --- a/gdb/cli/cli-logging.c
>>> +++ b/gdb/cli/cli-logging.c
>>> @@ -163,6 +163,17 @@ set_logging_off (const char *args, int from_tty)
>>>    saved_filename = NULL;
>>>  }
>>>  
>>> +/* Show the status set by set_logging_on / set_logging_off.  */
>>> +
>>> +static void
>>> +show_logging_on_off (const char *args, int from_tty)
>>> +{
>>> +  if (saved_filename)
> 
> Hi,
> 
> I just have a minor styling remark.  This should be:
> 
>   if (saved_filename != nullptr)
> 
> Shouldn't it?
> 

It should, thanks for noticing.  Anyway, in the new submission (
https://sourceware.org/pipermail/gdb-patches/2021-November/183749.html )
this test no longer occurs.

Thanks,
- Tom

> Best,
> Lancelot.
> 
>>> +    printf_unfiltered (_("Logging is enabled.\n"));
>>> +  else
>>> +    printf_unfiltered (_("Logging is disabled.\n"));
>>> +}
>>> +
>>>  void _initialize_cli_logging ();
>>>  void
>>>  _initialize_cli_logging ()
>>> @@ -211,4 +222,6 @@ The logfile is used when directing GDB's output."),
>>>  	   _("Enable logging."), &set_logging_cmdlist);
>>>    add_cmd ("off", class_support, set_logging_off,
>>>  	   _("Disable logging."), &set_logging_cmdlist);
>>> +  add_cmd ("active", class_support, show_logging_on_off,
>>> +	   _("Show whether logging is active."), &show_logging_cmdlist);
>>>  }
>>> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
>>> index 1b13973cdc5..4bea8f9b3dc 100644
>>> --- a/gdb/doc/gdb.texinfo
>>> +++ b/gdb/doc/gdb.texinfo
>>> @@ -1723,6 +1723,8 @@ Set @code{redirect} if you want output to go only to the log file.
>>>  By default, @value{GDBN} debug output will go to both the terminal and the logfile.
>>>  Set @code{debugredirect} if you want debug output to go only to the log file.
>>>  @kindex show logging
>>> +@item show logging [active|file|overwrite|redirect|debugredirect]
>>> +Show the current value of the logging setting.
>>>  @item show logging
>>>  Show the current values of the logging settings.
>>>  @end table
>>>
>>> base-commit: 0c3e266dc283a45a23185be3bb49e4d33987a892
>>>

  reply	other threads:[~2021-11-24 10:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 11:46 [pushed] " Tom de Vries
2021-11-23 11:49 ` [PATCH] " Tom de Vries
2021-11-23 12:30   ` Lancelot SIX
2021-11-24 10:31     ` Tom de Vries [this message]
2021-11-23 13:00   ` Eli Zaretskii
2021-11-24 10:41     ` Tom de Vries
2021-11-24 13:03       ` Eli Zaretskii
2021-11-23 13:30   ` Simon Marchi
2021-11-24 11:06     ` Tom de Vries
2021-11-23 12:49 ` [pushed] " Luis Machado
2021-11-23 12:56   ` Luis Machado
2021-11-24 10:32     ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1b7256c-63d5-f9dd-63ae-8030314a53d4@suse.de \
    --to=tdevries@suse.de \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).