This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] set logging {redirect|overwrite} warning
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 6 Aug 2010 20:29:19 +0200
- Subject: [patch] set logging {redirect|overwrite} warning
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, _("\