From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30475 invoked by alias); 15 Oct 2009 16:53:11 -0000 Received: (qmail 30464 invoked by uid 22791); 15 Oct 2009 16:53:09 -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; Thu, 15 Oct 2009 16:53:04 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 1525B4C01C; Thu, 15 Oct 2009 09:53:02 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost4.vmware.com (Postfix) with ESMTP id 06BE4C9BD2; Thu, 15 Oct 2009 09:53:02 -0700 (PDT) Message-ID: <4AD7522B.6030007@vmware.com> Date: Thu, 15 Oct 2009 16:53:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: Jiang Jilin , "gdb-patches@sourceware.org" Subject: Re: [RFA] Fix off-by-one error in record.c (record_list_release_first) References: <4AD35AB6.2050903@vmware.com> <7d77a27d0910121917w4abfc09cx43e5667393ef9f79@mail.gmail.com> <4AD4C07D.20502@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00340.txt.bz2 OK, going to commit it. Hui Zhu wrote: > 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. Jilin's patch is more >>> clear and can handle set_record_insn_max_num. >>> >>> I suggest we choice speed up. Do 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. Thanks Jilin for catching it. >> >> New diff: >> >> >> 2009-10-12 Michael Snyder >> >> * record.c (record_list_release_first): Do not decrement >> record_insn_num. >> (set_insn_num_max): Remove printf. >> Decrement record_insn_num in the loop. >> >> 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 13 Oct 2009 18:04:44 -0000 >> @@ -177,6 +177,11 @@ record_list_release_next (void) >> } >> } >> >> +/* Delete the first instruction from the beginning of the log, to make >> + room for adding a new instruction at the end of the log. >> + >> + Note -- this function does not modify record_insn_num. */ >> + >> static void >> record_list_release_first (void) >> { >> @@ -209,8 +214,6 @@ record_list_release_first (void) >> if (type == record_end) >> break; >> } >> - >> - record_insn_num--; >> } >> >> /* Add a struct record_entry to record_arch_list. */ >> @@ -1260,12 +1263,12 @@ set_record_insn_max_num (char *args, int >> { >> if (record_insn_num > record_insn_max_num && record_insn_max_num) >> { >> - printf_unfiltered (_("Record instructions number is bigger than " >> - "record instructions max number. Auto delete " >> - "the first ones?\n")); >> - >> + /* Count down record_insn_num while releasing records from list. */ >> while (record_insn_num > record_insn_max_num) >> - record_list_release_first (); >> + { >> + record_list_release_first (); >> + record_insn_num--; >> + } >> } >> } >> >> >>