From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17982 invoked by alias); 22 Oct 2009 02:30:12 -0000 Received: (qmail 17952 invoked by uid 22791); 22 Oct 2009 02:30:10 -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-pw0-f49.google.com (HELO mail-pw0-f49.google.com) (209.85.160.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Oct 2009 02:30:05 +0000 Received: by pwj3 with SMTP id 3so1332553pwj.8 for ; Wed, 21 Oct 2009 19:30:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.66.21 with SMTP id o21mr660514wfa.47.1256178604060; Wed, 21 Oct 2009 19:30:04 -0700 (PDT) In-Reply-To: <4ADF2613.5030400@vmware.com> References: <4AD358E7.50009@vmware.com> <200910202154.04566.pedro@codesourcery.com> <4ADE38DA.8040803@vmware.com> <200910210122.06549.pedro@codesourcery.com> <4ADE647D.10607@vmware.com> <4ADF2613.5030400@vmware.com> From: Hui Zhu Date: Thu, 22 Oct 2009 02:30:00 -0000 Message-ID: Subject: Re: [RFA] Expand "info record" To: Michael Snyder Cc: Pedro Alves , "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/msg00510.txt.bz2 Thanks for your works, Michael. Hui On Wed, Oct 21, 2009 at 23:17, Michael Snyder wrote: > Hui Zhu wrote: >> >> Thanks Michael. >> >> With change: >> =A0static struct target_ops record_ops; >> @@ -338,7 +344,10 @@ record_list_release_following (struct re >> =A0 =A0 { >> =A0 =A0 =A0 rec =3D tmp->next; >> =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) >> + =A0 =A0 =A0 { >> =A0 =A0 =A0 =A0record_insn_num--; >> + =A0 =A0 =A0 =A0 record_insn_count--; >> + =A0 =A0 =A0 } >> =A0 =A0 =A0 tmp =3D rec; >> =A0 =A0 } >> =A0} >> @@ -367,7 +376,6 @@ record_list_release_first (void) >> =A0 =A0 =A0 /* tmp is now isolated, and can be deleted. =A0*/ >> =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) >> =A0 =A0 =A0 =A0{ >> - =A0 =A0 =A0 =A0 record_insn_num--; >> =A0 =A0 =A0 =A0 =A0break; =A0 =A0 =A0 =A0/* End loop at first record_end= . =A0*/ >> =A0 =A0 =A0 =A0} >> To: >> =A0static struct target_ops record_ops; >> @@ -338,7 +344,10 @@ record_list_release_following (struct re >> =A0 =A0 { >> =A0 =A0 =A0 rec =3D tmp->next; >> =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) >> + =A0 =A0 =A0 { >> =A0 =A0 =A0 =A0 =A0record_insn_num--; >> + =A0 =A0 =A0 =A0 record_insn_count--; >> + =A0 =A0 =A0 } >> =A0 =A0 =A0 tmp =3D rec; >> =A0 =A0 } >> =A0} >> @@ -367,7 +376,6 @@ record_list_release_first (void) >> =A0 =A0 =A0 /* tmp is now isolated, and can be deleted. =A0*/ >> =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) >> - =A0 =A0 =A0 { >> - =A0 =A0 =A0 =A0 record_insn_num--; >> =A0 =A0 =A0 =A0 =A0break; =A0 =A0 =A0 =A0/* End loop at first record_end= . =A0*/ >> - =A0 =A0 =A0 } >> >> Just some format change. >> >> I am OK with this patch. > > Thanks, changes attached and committed. > > > 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.27 > diff -u -p -r1.27 record.c > --- record.c =A0 =A020 Oct 2009 23:06:13 -0000 =A0 =A0 =A01.27 > +++ record.c =A0 =A021 Oct 2009 15:16:47 -0000 > @@ -91,6 +91,7 @@ struct record_reg_entry > =A0struct record_end_entry > =A0{ > =A0 enum target_signal sigval; > + =A0ULONGEST insn_num; > =A0}; > > =A0enum record_type > @@ -166,8 +167,13 @@ static struct record_entry *record_arch_ > > =A0/* 1 ask user. 0 auto delete the last struct record_entry. =A0*/ > =A0static int record_stop_at_limit =3D 1; > +/* Maximum allowed number of insns in execution log. =A0*/ > =A0static unsigned int record_insn_max_num =3D DEFAULT_RECORD_INSN_MAX_NU= M; > +/* Actual count of insns presently in execution log. =A0*/ > =A0static int record_insn_num =3D 0; > +/* Count of insns logged so far (may be larger > + =A0 than count of insns presently in execution log). =A0*/ > +static ULONGEST record_insn_count; > > =A0/* The target_ops of process record. =A0*/ > =A0static struct target_ops record_ops; > @@ -338,7 +344,10 @@ record_list_release_following (struct re > =A0 =A0 { > =A0 =A0 =A0 rec =3D tmp->next; > =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) > - =A0 =A0 =A0 record_insn_num--; > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 record_insn_num--; > + =A0 =A0 =A0 =A0 record_insn_count--; > + =A0 =A0 =A0 } > =A0 =A0 =A0 tmp =3D rec; > =A0 =A0 } > =A0} > @@ -366,10 +375,7 @@ record_list_release_first (void) > > =A0 =A0 =A0 /* tmp is now isolated, and can be deleted. =A0*/ > =A0 =A0 =A0 if (record_entry_release (tmp) =3D=3D record_end) > - =A0 =A0 =A0 { > - =A0 =A0 =A0 =A0 record_insn_num--; > - =A0 =A0 =A0 =A0 break; =A0 =A0 =A0 =A0/* End loop at first record_end. = =A0*/ > - =A0 =A0 =A0 } > + =A0 =A0 =A0 break; =A0/* End loop at first record_end. =A0*/ > > =A0 =A0 =A0 if (!record_first.next) > =A0 =A0 =A0 =A0{ > @@ -494,6 +500,7 @@ record_arch_list_add_end (void) > > =A0 rec =3D record_end_alloc (); > =A0 rec->u.end.sigval =3D TARGET_SIGNAL_0; > + =A0rec->u.end.insn_num =3D ++record_insn_count; > > =A0 record_arch_list_add (rec); > > @@ -800,6 +807,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} > @@ -1458,8 +1466,8 @@ cmd_record_stop (char *args, int from_tt > =A0 if (current_target.to_stratum =3D=3D record_stratum) > =A0 =A0 { > =A0 =A0 =A0 unpush_target (&record_ops); > - =A0 =A0 =A0printf_unfiltered (_("Process record is stoped and all execu= tion " > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "log is deleted.\n"= )); > + =A0 =A0 =A0printf_unfiltered (_("Process record is stopped and all exec= ution " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "logs are deleted.\= n")); > =A0 =A0 } > =A0 else > =A0 =A0 printf_unfiltered (_("Process record is not started.\n")); > @@ -1481,16 +1489,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; > > @@ -1508,10 +1506,59 @@ show_record_command (char *args, int fro > =A0 cmd_show_list (show_record_cmdlist, from_tty, ""); > =A0} > > +/* Display some statistics about the execution log. =A0*/ > + > =A0static void > =A0info_record_command (char *args, int from_tty) > =A0{ > - =A0cmd_show_list (info_record_cmdlist, from_tty, ""); > + =A0struct record_entry *p; > + > + =A0if (current_target.to_stratum =3D=3D record_stratum) > + =A0 =A0{ > + =A0 =A0 =A0if (RECORD_IS_REPLAY) > + =A0 =A0 =A0 printf_filtered (_("Replay mode:\n")); > + =A0 =A0 =A0else > + =A0 =A0 =A0 printf_filtered (_("Record mode:\n")); > + > + =A0 =A0 =A0/* Find entry for first actual instruction in the log. =A0*/ > + =A0 =A0 =A0for (p =3D record_first.next; > + =A0 =A0 =A0 =A0 =A0p !=3D NULL && p->type !=3D record_end; > + =A0 =A0 =A0 =A0 =A0p =3D p->next) > + =A0 =A0 =A0 ; > + > + =A0 =A0 =A0/* Do we have a log at all? =A0*/ > + =A0 =A0 =A0if (p !=3D NULL && p->type =3D=3D record_end) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 /* Display instruction number for first instruction in = the log. > =A0*/ > + =A0 =A0 =A0 =A0 printf_filtered (_("Lowest recorded instruction number = is %s.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pulongest (p->u.end.= insn_num)); > + > + =A0 =A0 =A0 =A0 /* If in replay mode, display where we are in the log. = =A0*/ > + =A0 =A0 =A0 =A0 if (RECORD_IS_REPLAY) > + =A0 =A0 =A0 =A0 =A0 printf_filtered (_("Current instruction number is %= s.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pulongest (recor= d_list->u.end.insn_num)); > + > + =A0 =A0 =A0 =A0 /* Display instruction number for last instruction in t= he log. =A0*/ > + =A0 =A0 =A0 =A0 printf_filtered (_("Highest recorded instruction number= is > %s.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pulongest (record_in= sn_count)); > + > + =A0 =A0 =A0 =A0 /* Display log count. =A0*/ > + =A0 =A0 =A0 =A0 printf_filtered (_("Log contains %d instructions.\n"), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_insn_num); > + =A0 =A0 =A0 } > + =A0 =A0 =A0else > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 printf_filtered (_("No instructions have been logged.\n= ")); > + =A0 =A0 =A0 } > + =A0 =A0} > + =A0else > + =A0 =A0{ > + =A0 =A0 =A0printf_filtered (_("target record is not active.\n")); > + =A0 =A0} > + > + =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 > @@ -1581,7 +1628,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} > >