From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8223 invoked by alias); 27 Feb 2008 20:52:10 -0000 Received: (qmail 8213 invoked by uid 22791); 27 Feb 2008 20:52:09 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 27 Feb 2008 20:51:50 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 16FD098140; Wed, 27 Feb 2008 20:51:48 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id A39F49811F; Wed, 27 Feb 2008 20:51:45 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JUTFg-0005xi-Pr; Wed, 27 Feb 2008 15:51:44 -0500 Date: Wed, 27 Feb 2008 21:02:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: Eli Zaretskii , gdb-patches@sourceware.org Subject: Re: [rfa/rfc] Debug output timestamps Message-ID: <20080227205144.GB14556@caradoc.them.org> Mail-Followup-To: Joel Brobecker , Eli Zaretskii , gdb-patches@sourceware.org References: <20070413133209.GA11212@caradoc.them.org> <20070415080556.GA29271@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070415080556.GA29271@adacore.com> User-Agent: Mutt/1.5.17 (2007-12-11) 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: 2008-02/txt/msg00453.txt.bz2 On Sun, Apr 15, 2007 at 12:05:56PM +0400, Joel Brobecker wrote: > > > Does anyone else think this would be useful? I was trying to figure > > > out how long some operations took during single stepping, in a > > > relatively unintrusive way. It's not very accurate, but it was still > > > handy. > > > > Sounds like a good idea to me. > > Me too! I have very belatedly checked this in. (No, there wasn't any good reason; I forgot.) I started a new NEWS section on trunk for post-GDB-6.8, since the branch date has passed. -- Daniel Jacobowitz CodeSourcery 2008-02-27 Daniel Jacobowitz * 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. 2008-02-27 Daniel Jacobowitz * gdb.texinfo (Debugging Output): Document "set debug timestamp". Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.259 diff -u -p -r1.259 NEWS --- NEWS 19 Feb 2008 18:20:45 -0000 1.259 +++ NEWS 27 Feb 2008 20:46:03 -0000 @@ -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 Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.184 diff -u -p -r1.184 utils.c --- utils.c 1 Jan 2008 22:53:13 -0000 1.184 +++ utils.c 27 Feb 2008 20:46:04 -0000 @@ -63,6 +63,9 @@ #include "readline/readline.h" +#include +#include + #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 *str 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 f { 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 dis 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. */ Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.469 diff -u -p -r1.469 gdb.texinfo --- doc/gdb.texinfo 25 Feb 2008 20:34:40 -0000 1.469 +++ doc/gdb.texinfo 27 Feb 2008 20:46:06 -0000 @@ -16387,6 +16387,14 @@ until the next time you connect to a tar @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