diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-02-27 20:50:49 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-02-27 20:50:49 +0000 |
commit | 75feb17dd5732e38938d35ddfc6eacdc12cab759 (patch) | |
tree | c6ac2dce69f51824b051b7cfa7d29d3fd638f859 /gdb | |
parent | b40e7bf371ed0fb604e3907327b32ef6f039c4c9 (diff) | |
download | gdb-75feb17dd5732e38938d35ddfc6eacdc12cab759.zip gdb-75feb17dd5732e38938d35ddfc6eacdc12cab759.tar.gz gdb-75feb17dd5732e38938d35ddfc6eacdc12cab759.tar.bz2 |
* utils.c (debug_timestamp): New.
(vfprintf_unfiltered): Print timestamps if requested.
(show_debug_timestamp): New.
(initialize_utils): Register "set debug timestamp".
* NEWS: Mention "set debug timestamp". Add GDB 6.8 section.
* gdb.texinfo (Debugging Output): Document "set debug timestamp".
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/NEWS | 10 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 8 | ||||
-rw-r--r-- | gdb/utils.c | 33 |
3 files changed, 50 insertions, 1 deletions
@@ -1,7 +1,15 @@ What has changed in GDB? (Organized release by release) -*** Changes since GDB 6.7 +*** Changes since GDB 6.8 + +* New commands + +set debug timetstamp +show debug timestamp + Display timestamps with GDB debugging output. + +*** Changes in GDB 6.8 * New native configurations diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 722db28..4f4b694 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -16387,6 +16387,14 @@ until the next time you connect to a target or use the @code{run} command. @item show debug target Displays the current state of displaying @value{GDBN} target debugging info. +@item set debug timestamp +@cindex timestampping debugging info +Turns on or off display of timestamps with @value{GDBN} debugging info. +When enabled, seconds and microseconds are displayed before each debugging +message. +@item show debug timestamp +Displays the current state of displaying timestamps with @value{GDBN} +debugging info. @item set debugvarobj @cindex variable object debugging info Turns on or off display of @value{GDBN} variable object debugging diff --git a/gdb/utils.c b/gdb/utils.c index 95761cc..91c593e 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -63,6 +63,9 @@ #include "readline/readline.h" +#include <sys/time.h> +#include <time.h> + #if !HAVE_DECL_MALLOC extern PTR malloc (); /* OK: PTR */ #endif @@ -92,6 +95,10 @@ static void prompt_for_continue (void); static void set_screen_size (void); static void set_width (void); +/* A flag indicating whether to timestamp debugging messages. */ + +static int debug_timestamp = 0; + /* Chain of cleanup actions established with make_cleanup, to be executed if an error happens. */ @@ -2121,6 +2128,16 @@ vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args) linebuffer = xstrvprintf (format, args); old_cleanups = make_cleanup (xfree, linebuffer); + if (debug_timestamp && stream == gdb_stdlog) + { + struct timeval tm; + char *timestamp; + + gettimeofday (&tm, NULL); + timestamp = xstrprintf ("%ld:%ld ", (long) tm.tv_sec, (long) tm.tv_usec); + make_cleanup (xfree, timestamp); + fputs_unfiltered (timestamp, stream); + } fputs_unfiltered (linebuffer, stream); do_cleanups (old_cleanups); } @@ -2437,6 +2454,13 @@ pagination_off_command (char *arg, int from_tty) { pagination_enabled = 0; } + +static void +show_debug_timestamp (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("Timestamping debugging messages is %s.\n"), value); +} void @@ -2497,6 +2521,15 @@ Show demangling of C++/ObjC names in disassembly listings."), NULL, NULL, show_asm_demangle, &setprintlist, &showprintlist); + + add_setshow_boolean_cmd ("timestamp", class_maintenance, + &debug_timestamp, _("\ +Set timestamping of debugging messages."), _("\ +Show timestamping of debugging messages."), _("\ +When set, debugging messages will be marked with seconds and microseconds."), + NULL, + show_debug_timestamp, + &setdebuglist, &showdebuglist); } /* Machine specific function to handle SIGWINCH signal. */ |