From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1922A385840E for ; Wed, 24 Nov 2021 10:31:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1922A385840E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4BFB11FD2F; Wed, 24 Nov 2021 10:31:43 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 29FCD13F05; Wed, 24 Nov 2021 10:31:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7TquCI8UnmG4ZgAAMHmgww (envelope-from ); Wed, 24 Nov 2021 10:31:43 +0000 Subject: Re: [PATCH] [gdb/cli] Add command: show logging active To: Lancelot SIX Cc: gdb-patches@sourceware.org, Eli Zaretskii References: <20211123114603.6284-1-tdevries@suse.de> <9ab6df29-2990-704c-ea96-6af09d2e9a1e@suse.de> <20211123123041.hbq4e5fc22g7gab7@ubuntu.lan> From: Tom de Vries Message-ID: Date: Wed, 24 Nov 2021 11:31:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20211123123041.hbq4e5fc22g7gab7@ubuntu.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 10:31:45 -0000 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 >>>