From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18979 invoked by alias); 15 Oct 2009 03:18:35 -0000 Received: (qmail 18961 invoked by uid 22791); 15 Oct 2009 03:18:34 -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-pz0-f192.google.com (HELO mail-pz0-f192.google.com) (209.85.222.192) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Oct 2009 03:18:29 +0000 Received: by pzk30 with SMTP id 30so412483pzk.24 for ; Wed, 14 Oct 2009 20:18:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.60.19 with SMTP id i19mr719593wfa.315.1255576708116; Wed, 14 Oct 2009 20:18:28 -0700 (PDT) In-Reply-To: <4AD4C07D.20502@vmware.com> References: <4AD35AB6.2050903@vmware.com> <7d77a27d0910121917w4abfc09cx43e5667393ef9f79@mail.gmail.com> <4AD4C07D.20502@vmware.com> From: Hui Zhu Date: Thu, 15 Oct 2009 03:18:00 -0000 Message-ID: Subject: Re: [RFA] Fix off-by-one error in record.c (record_list_release_first) To: Michael Snyder Cc: Jiang Jilin , "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/msg00328.txt.bz2 Thanks Michael, I think this patch is OK with me. Hui On Wed, Oct 14, 2009 at 02:01, Michael Snyder wrote: > Hui Zhu wrote: >> >> Thanks Michael and Jilin, >> >> I think the Michael's patch is more spend up. =A0Jilin's patch is more >> clear and can handle set_record_insn_max_num. >> >> I suggest we choice speed up. =A0Do you think it's OK? >> >> If we choice it, Michael, could you please add some comments to >> "record_list_release_first" or change it's name to >> "record_list_release_first_without_update_xxx" to make it clear. >> And please update set_record_insn_max_num. > > Hah, sorry, I completely missed the implications for > set_record_insn_max_num. =A0Thanks Jilin for catching it. > > New diff: > > > 2009-10-12 =A0Michael Snyder =A0 > > =A0 =A0 =A0 =A0* record.c (record_list_release_first): Do not decrement > =A0 =A0 =A0 =A0record_insn_num. > =A0 =A0 =A0 =A0(set_insn_num_max): Remove printf. > =A0 =A0 =A0 =A0Decrement record_insn_num in the loop. > > 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 =A013 Oct 2009 18:04:44 -0000 > @@ -177,6 +177,11 @@ record_list_release_next (void) > =A0 =A0 } > =A0} > > +/* Delete the first instruction from the beginning of the log, to make > + =A0 room for adding a new instruction at the end of the log. > + > + =A0 Note -- this function does not modify record_insn_num. =A0*/ > + > =A0static void > =A0record_list_release_first (void) > =A0{ > @@ -209,8 +214,6 @@ record_list_release_first (void) > =A0 =A0 =A0 if (type =3D=3D record_end) > =A0 =A0 =A0 =A0break; > =A0 =A0 } > - > - =A0record_insn_num--; > =A0} > > =A0/* Add a struct record_entry to record_arch_list. =A0*/ > @@ -1260,12 +1263,12 @@ set_record_insn_max_num (char *args, int > =A0{ > =A0 if (record_insn_num > record_insn_max_num && record_insn_max_num) > =A0 =A0 { > - =A0 =A0 =A0printf_unfiltered (_("Record instructions number is bigger t= han " > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"record instructions= max number. =A0Auto delete " > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"the first ones?\n")= ); > - > + =A0 =A0 =A0/* Count down record_insn_num while releasing records from l= ist. =A0*/ > =A0 =A0 =A0 while (record_insn_num > record_insn_max_num) > - =A0 =A0 =A0 record_list_release_first (); > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 record_list_release_first (); > + =A0 =A0 =A0 =A0 record_insn_num--; > + =A0 =A0 =A0 } > =A0 =A0 } > =A0} > > >