public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] set logging {redirect|overwrite} warning
@ 2010-08-06 18:29 Jan Kratochvil
  2010-08-12 16:07 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2010-08-06 18:29 UTC (permalink / raw)
  To: gdb-patches

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-02 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-06 18:29 [patch] set logging {redirect|overwrite} warning Jan Kratochvil
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

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).