From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29744 invoked by alias); 13 Oct 2009 06:03:05 -0000 Received: (qmail 29509 invoked by uid 22791); 13 Oct 2009 06:03:02 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f202.google.com (HELO mail-px0-f202.google.com) (209.85.216.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Oct 2009 06:02:58 +0000 Received: by pxi40 with SMTP id 40so10420601pxi.24 for ; Mon, 12 Oct 2009 23:02:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.138.4 with SMTP id q4mr573249wfn.38.1255413777081; Mon, 12 Oct 2009 23:02:57 -0700 (PDT) In-Reply-To: <4AD358E7.50009@vmware.com> References: <4AD358E7.50009@vmware.com> From: Hui Zhu Date: Tue, 13 Oct 2009 06:03:00 -0000 Message-ID: Subject: Re: [RFA] Expand "info record" To: Michael Snyder Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00259.txt.bz2 Thanks Michael, I have 2 questions for this patch: 1. info rec will not show record_insn_num? 2. (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 Do you think the last line need a dot? Hui On Tue, Oct 13, 2009 at 00:27, Michael Snyder wrote: > Hi Hui, > > This patch expands on the output of "info record" so that it looks like > this: > > (gdb) info rec > Lowest =A0recorded 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 > > > 2009-10-12 =A0Michael Snyder =A0 > =A0 =A0 =A0 =A0Elaborate "info record". > =A0 =A0 =A0 =A0* record.c (struct record_end_entry): New field 'insn_num'. > =A0 =A0 =A0 =A0(record_insn_count): New variable. > =A0 =A0 =A0 =A0(record_open): Initialize record_insn_count. > =A0 =A0 =A0 =A0(info_record_command): Display contents of record log as > =A0 =A0 =A0 =A0lowest, current, and highest instruction counts. > =A0 =A0 =A0 =A0(show_record_insn_number): Delete. > =A0 =A0 =A0 =A0(_initialize_record): Remove add_cmd show_record_insn_numb= er. > > Index: record.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/record.c,v > retrieving revision 1.20 > diff -u -p -r1.20 record.c > --- record.c =A0 =A027 Sep 2009 02:49:34 -0000 =A0 =A0 =A01.20 > +++ record.c =A0 =A012 Oct 2009 16:25:38 -0000 > @@ -62,6 +62,7 @@ struct record_mem_entry > =A0struct record_end_entry > =A0{ > =A0 enum target_signal sigval; > + =A0unsigned long long insn_num; > =A0}; > > =A0enum record_type > @@ -100,6 +101,7 @@ static struct record_entry *record_arch_ > =A0static int record_stop_at_limit =3D 1; > =A0static int record_insn_max_num =3D DEFAULT_RECORD_INSN_MAX_NUM; > =A0static int record_insn_num =3D 0; > +static unsigned long long record_insn_count; > > =A0/* The target_ops of process record. =A0*/ > =A0static struct target_ops record_ops; > @@ -322,6 +324,7 @@ record_arch_list_add_end (void) > =A0 rec->next =3D NULL; > =A0 rec->type =3D record_end; > =A0 rec->u.end.sigval =3D TARGET_SIGNAL_0; > + =A0rec->u.end.insn_num =3D record_insn_count++; > > =A0 record_arch_list_add (rec); > > @@ -552,6 +555,7 @@ record_open (char *name, int from_tty) > > =A0 /* Reset */ > =A0 record_insn_num =3D 0; > + =A0record_insn_count =3D 0; > =A0 record_list =3D &record_first; > =A0 record_list->next =3D NULL; > =A0} > @@ -1269,16 +1273,6 @@ set_record_insn_max_num (char *args, int > =A0 =A0 } > =A0} > > -/* Print the current index into the record log (number of insns recorded > - =A0 so far). =A0*/ > - > -static void > -show_record_insn_number (char *ignore, int from_tty) > -{ > - =A0printf_unfiltered (_("Record instruction number is %d.\n"), > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_insn_num); > -} > - > =A0static struct cmd_list_element *record_cmdlist, *set_record_cmdlist, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *show_record_= cmdlist, *info_record_cmdlist; > > @@ -1299,7 +1293,31 @@ show_record_command (char *args, int fro > =A0static void > =A0info_record_command (char *args, int from_tty) > =A0{ > - =A0cmd_show_list (info_record_cmdlist, from_tty, ""); > + =A0struct record_entry *p; > + > + =A0/* Find entry for first actual instruction in the log. =A0*/ > + =A0for (p =3D record_first.next; > + =A0 =A0 =A0 (p !=3D NULL) && (p->type !=3D record_end); > + =A0 =A0 =A0 p =3D p->next) > + =A0 =A0; > + > + =A0/* Display instruction number for first instruction in the log. =A0*/ > + =A0if (p !=3D NULL && p->type =3D=3D record_end) > + =A0 =A0printf_filtered (_("Lowest =A0recorded instruction number is %ll= u.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0p->u.end.insn_num); > + > + =A0/* If we are not at the end of the log, display where we are. =A0*/ > + =A0if (record_list->next !=3D NULL && record_list->type =3D=3D record_e= nd) > + =A0 =A0printf_filtered (_("Current instruction number is %llu.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_list->u.end.insn_num); > + > + =A0/* Display instruction number for last instruction in the log. =A0*/ > + =A0printf_filtered (_("Highest recorded instruction number is %llu.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_insn_count ? record_insn_coun= t - 1 : 0); > + > + =A0/* Display max log size. =A0*/ > + =A0printf_filtered (_("Max logged instructions is %d\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_insn_max_num); > =A0} > > =A0void > @@ -1369,7 +1387,4 @@ Set the maximum number of instructions t > =A0record/replay buffer. =A0Zero means unlimited. =A0Default is 200000."), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0set_record_insn_ma= x_num, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NULL, &set_record_= cmdlist, &show_record_cmdlist); > - =A0add_cmd ("insn-number", class_obscure, show_record_insn_number, > - =A0 =A0 =A0 =A0 =A0_("Show the current number of instructions in the " > - =A0 =A0 =A0 =A0 =A0 =A0"record/replay buffer."), &info_record_cmdlist); > =A0} > >