From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6668 invoked by alias); 6 Aug 2010 18:29:30 -0000 Received: (qmail 6653 invoked by uid 22791); 6 Aug 2010 18:29:29 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 18:29:24 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o76ITNEX014507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Aug 2010 14:29:23 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o76ITLvA014044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 6 Aug 2010 14:29:22 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o76ITKag003959 for ; Fri, 6 Aug 2010 20:29:20 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o76ITKNl003958 for gdb-patches@sourceware.org; Fri, 6 Aug 2010 20:29:20 +0200 Date: Fri, 06 Aug 2010 18:29:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] set logging {redirect|overwrite} warning Message-ID: <20100806182919.GA3654@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00083.txt.bz2 Hi, downstream Bug: https://bugzilla.redhat.com/show_bug.cgi?id=593521 After (gdb) set logging on any settings like (gdb) set logging redirect on or (gdb) set logging overwrite on get silently set but ... they do not work. They get active only after next (gdb) set logging off (gdb) set logging on I understand one a GDB patch could make them active immediately etc. The patch provided below is safe for regressions, it fixes the problem, it was easy to develop, it does not complicate the code for future fixes/extensions. (gdb) set logging on Copying output to gdb.txt. (gdb) set logging redirect Already logging to gdb.txt. You should turn the logging off and on to make the new setting effective. No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. Thanks, Jan gdb/ 2010-08-06 Jan Kratochvil * cli/cli-logging.c (set_logging_overwrite, set_logging_redirect): New functions. (_initialize_cli_logging): Install them. --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -46,6 +46,17 @@ show_logging_filename (struct ui_file *file, int from_tty, } int logging_overwrite; + +static void +set_logging_overwrite (char *args, int from_tty, struct cmd_list_element *c) +{ + if (saved_filename) + fprintf_unfiltered (gdb_stdout, _("Already logging to %s. You should " + "turn the logging off and on to make " + "the new setting effective.\n"), + saved_filename); +} + static void show_logging_overwrite (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -56,6 +67,17 @@ Whether logging overwrites or appends to the log file is %s.\n"), } int logging_redirect; + +static void +set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) +{ + if (saved_filename) + fprintf_unfiltered (gdb_stdout, _("Already logging to %s. You should " + "turn the logging off and on to make " + "the new setting effective.\n"), + saved_filename); +} + static void show_logging_redirect (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -211,7 +233,7 @@ _initialize_cli_logging (void) Set whether logging overwrites or appends to the log file."), _("\ Show whether logging overwrites or appends to the log file."), _("\ If set, logging overrides the log file."), - NULL, + set_logging_overwrite, show_logging_overwrite, &set_logging_cmdlist, &show_logging_cmdlist); add_setshow_boolean_cmd ("redirect", class_support, &logging_redirect, _("\ @@ -219,7 +241,7 @@ Set the logging output mode."), _("\ Show the logging output mode."), _("\ If redirect is off, output will go to both the screen and the log file.\n\ If redirect is on, output will go only to the log file."), - NULL, + set_logging_redirect, show_logging_redirect, &set_logging_cmdlist, &show_logging_cmdlist); add_setshow_filename_cmd ("file", class_support, &logging_filename, _("\