From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Jiang Jilin <freephp@gmail.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix off-by-one error in record.c (record_list_release_first)
Date: Thu, 15 Oct 2009 16:53:00 -0000 [thread overview]
Message-ID: <4AD7522B.6030007@vmware.com> (raw)
In-Reply-To: <daef60380910142018y14635849mc870b741c17f66be@mail.gmail.com>
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 <msnyder@vmware.com> 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 <msnyder@vmware.com>
>>
>> * 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--;
>> + }
>> }
>> }
>>
>>
>>
next prev parent reply other threads:[~2009-10-15 16:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-12 16:39 Michael Snyder
2009-10-13 2:17 ` Jiang Jilin
2009-10-13 6:46 ` Hui Zhu
2009-10-13 8:28 ` Jiang Jilin
2009-10-13 18:06 ` Michael Snyder
2009-10-15 3:18 ` Hui Zhu
2009-10-15 16:53 ` Michael Snyder [this message]
2009-10-13 17:25 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD7522B.6030007@vmware.com \
--to=msnyder@vmware.com \
--cc=freephp@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox