[PATCH] [gdb/cli] Add command: show logging active

Tom de Vries tdevries@suse.de
Wed Nov 24 10:41:41 GMT 2021


On 11/23/21 2:00 PM, Eli Zaretskii wrote:
>> From: Tom de Vries <tdevries@suse.de>
>> Date: Tue, 23 Nov 2021 12:49:34 +0100
>>
>>> Currently, there's no gdb command that shows whether logging is enabled or
>>> disabled.
>>>
>>> There's the show logging command, but output is identical in both cases.
>>> With logging disabled, we have:
>>> ...
>>> (gdb) set logging off
>>> (gdb) show logging
>>> logging debugredirect:  The logging output mode is off.
>>> logging file:  The current logfile is "gdb.txt".
>>> logging overwrite: \
>>>   Whether logging overwrites or appends to the log file is off.
>>> logging redirect:  The logging output mode is off.
>>> ...
>>> and with logging enabled we have:
>>> ...
>>> (gdb) set logging on
>>> Copying output to gdb.txt.
>>> Copying debug output to gdb.txt.
>>> (gdb) show logging
>>> logging debugredirect:  The logging output mode is off.
>>> logging file:  The current logfile is "gdb.txt".
>>> logging overwrite: \
>>>   Whether logging overwrites or appends to the log file is off.
>>> logging redirect:  The logging output mode is off.
>>> ...
>>>
>>> Add a "show logging active" command, such that we have:
>>> ...
>>> (gdb) show logging
>>> logging active:  Logging is disabled.
>>> logging debugredirect:  The logging output mode is off.
>>> logging file:  The current logfile is "gdb.txt".
>>> logging overwrite: \
>>>   Whether logging overwrites or appends to the log file is off.
>>> logging redirect:  The logging output mode is off.
>>> ...
> 
> Isn't the current behavior a bug that should be fixed, instead of
> introducing a new command?  Or what am I missing?
> 

Well, AFAIU the bug is that we can't see whether logging is enabled or
not, and adding the new command fixes that bug.

Normally, a command "set logging on/off" would have a counterpart "show
logging" that shows the effects of the command, but in this case "show
logging" shows the status of the subcommands only.

In the latest version, this is fixed by deprecating "set logging on/off"
and replacing it with "set logging enabled on/off", which does have a
direct show counterpart.

I hope this answers you question.

> The documentation part is OK, assuming that we do want a new
> sub-command.

Thanks for the review.  Could you also review the new version here (
https://sourceware.org/pipermail/gdb-patches/2021-November/183749.html ) ?

Thanks,
- Tom


More information about the Gdb-patches mailing list