From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5086 invoked by alias); 12 Oct 2009 16:32:17 -0000 Received: (qmail 5068 invoked by uid 22791); 12 Oct 2009 16:32:14 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Oct 2009 16:32:09 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 6FF142508C; Mon, 12 Oct 2009 09:32:08 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id 66023CD99E; Mon, 12 Oct 2009 09:32:08 -0700 (PDT) Message-ID: <4AD358E7.50009@vmware.com> Date: Mon, 12 Oct 2009 16:32:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" , Hui Zhu Subject: [RFA] Expand "info record" Content-Type: multipart/mixed; boundary="------------070708080400060308060409" 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: 2009-10/txt/msg00236.txt.bz2 This is a multi-part message in MIME format. --------------070708080400060308060409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 289 Hi Hui, This patch expands on the output of "info record" so that it looks like this: (gdb) info rec Lowest recorded instruction number is 0. Current instruction number is 46. Highest recorded instruction number is 1016. Max logged instructions is 200000 What do you think? Michael --------------070708080400060308060409 Content-Type: text/plain; name="inforec.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="inforec.txt" Content-length: 3615 2009-10-12 Michael Snyder Elaborate "info record". * record.c (struct record_end_entry): New field 'insn_num'. (record_insn_count): New variable. (record_open): Initialize record_insn_count. (info_record_command): Display contents of record log as lowest, current, and highest instruction counts. (show_record_insn_number): Delete. (_initialize_record): Remove add_cmd show_record_insn_number. Index: record.c =================================================================== RCS file: /cvs/src/src/gdb/record.c,v retrieving revision 1.20 diff -u -p -r1.20 record.c --- record.c 27 Sep 2009 02:49:34 -0000 1.20 +++ record.c 12 Oct 2009 16:25:38 -0000 @@ -62,6 +62,7 @@ struct record_mem_entry struct record_end_entry { enum target_signal sigval; + unsigned long long insn_num; }; enum record_type @@ -100,6 +101,7 @@ static struct record_entry *record_arch_ static int record_stop_at_limit = 1; static int record_insn_max_num = DEFAULT_RECORD_INSN_MAX_NUM; static int record_insn_num = 0; +static unsigned long long record_insn_count; /* The target_ops of process record. */ static struct target_ops record_ops; @@ -322,6 +324,7 @@ record_arch_list_add_end (void) rec->next = NULL; rec->type = record_end; rec->u.end.sigval = TARGET_SIGNAL_0; + rec->u.end.insn_num = record_insn_count++; record_arch_list_add (rec); @@ -552,6 +555,7 @@ record_open (char *name, int from_tty) /* Reset */ record_insn_num = 0; + record_insn_count = 0; record_list = &record_first; record_list->next = NULL; } @@ -1269,16 +1273,6 @@ set_record_insn_max_num (char *args, int } } -/* Print the current index into the record log (number of insns recorded - so far). */ - -static void -show_record_insn_number (char *ignore, int from_tty) -{ - printf_unfiltered (_("Record instruction number is %d.\n"), - record_insn_num); -} - static struct cmd_list_element *record_cmdlist, *set_record_cmdlist, *show_record_cmdlist, *info_record_cmdlist; @@ -1299,7 +1293,31 @@ show_record_command (char *args, int fro static void info_record_command (char *args, int from_tty) { - cmd_show_list (info_record_cmdlist, from_tty, ""); + struct record_entry *p; + + /* Find entry for first actual instruction in the log. */ + for (p = record_first.next; + (p != NULL) && (p->type != record_end); + p = p->next) + ; + + /* Display instruction number for first instruction in the log. */ + if (p != NULL && p->type == record_end) + printf_filtered (_("Lowest recorded instruction number is %llu.\n"), + p->u.end.insn_num); + + /* If we are not at the end of the log, display where we are. */ + if (record_list->next != NULL && record_list->type == record_end) + printf_filtered (_("Current instruction number is %llu.\n"), + record_list->u.end.insn_num); + + /* Display instruction number for last instruction in the log. */ + printf_filtered (_("Highest recorded instruction number is %llu.\n"), + record_insn_count ? record_insn_count - 1 : 0); + + /* Display max log size. */ + printf_filtered (_("Max logged instructions is %d\n"), + record_insn_max_num); } void @@ -1369,7 +1387,4 @@ Set the maximum number of instructions t record/replay buffer. Zero means unlimited. Default is 200000."), set_record_insn_max_num, NULL, &set_record_cmdlist, &show_record_cmdlist); - add_cmd ("insn-number", class_obscure, show_record_insn_number, - _("Show the current number of instructions in the " - "record/replay buffer."), &info_record_cmdlist); } --------------070708080400060308060409--