public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] set logging {redirect|overwrite} warning
Date: Fri, 06 Aug 2010 18:29:00 -0000	[thread overview]
Message-ID: <20100806182919.GA3654@host1.dyn.jankratochvil.net> (raw)

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  <jan.kratochvil@redhat.com>

	* 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, _("\

             reply	other threads:[~2010-08-06 18:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 18:29 Jan Kratochvil [this message]
2010-08-12 16:07 ` Pedro Alves
2010-08-13 21:56   ` Jan Kratochvil
2010-09-02 15:21     ` ping: " Jan Kratochvil
2010-09-02 15:36       ` Pedro Alves
2010-09-02 16:51         ` Jan Kratochvil

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=20100806182919.GA3654@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).