From: Hui Zhu <teawater@gmail.com>
To: Jiang Jilin <freephp@gmail.com>, Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix off-by-one error in record.c (record_list_release_first)
Date: Tue, 13 Oct 2009 06:46:00 -0000 [thread overview]
Message-ID: <daef60380910122346x7a0ffc10jcd7ce7f137e9028f@mail.gmail.com> (raw)
In-Reply-To: <7d77a27d0910121917w4abfc09cx43e5667393ef9f79@mail.gmail.com>
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.
Thanks,
Hui
On Tue, Oct 13, 2009 at 10:17, Jiang Jilin <freephp@gmail.com> wrote:
> On Tue, Oct 13, 2009 at 12:35 AM, Michael Snyder <msnyder@vmware.com> wrote:
>> Hui,
>>
>> My "info record" patch helped me to find a bug.
>> I found that, once we start calling record_list_release_first,
>> we start adding two instructions to the log for every one
>> instruction we remove. Therefore the log continues to grow,
>> even though it is supposed to remain constant in size.
>>
>> This is because record_insn_num is not incremented if we
>> call record_list_release_first -- but record_list_release_first
>> does decrement it.
>
> Hi Michael,
>
> I've noticed this bug(maybe) earlier, but I prefer fixing the caller
> functions, not the callee function record_list_release_first. And
> your patch doesn't handle set_record_insn_max_num.
>
> Thanks!
>
> 2009-10-13 Michael Snyder <msnyder@vmware.com>
> Jiang Jilin <freephp@gmail.com>
>
> * record.c (record_message): Increase record_insn_num after
> record_list_release_first.
> (record_registers_change): Ditto.
> (record_xfer_partial): Ditto.
>
> diff --git a/gdb/record.c b/gdb/record.c
> index 8b56010..0208dac 100644
> --- a/gdb/record.c
> +++ b/gdb/record.c
> @@ -438,8 +438,8 @@ record_message (void *args)
>
> if (record_insn_num == record_insn_max_num && record_insn_max_num)
> record_list_release_first ();
> - else
> - record_insn_num++;
> +
> + record_insn_num++;
>
> return 1;
> }
> @@ -1008,8 +1008,8 @@ record_registers_change (struct regcache
> *regcache, int regnum)
>
> if (record_insn_num == record_insn_max_num && record_insn_max_num)
> record_list_release_first ();
> - else
> - record_insn_num++;
> +
> + record_insn_num++;
> }
>
> static void
> @@ -1121,8 +1121,8 @@ record_xfer_partial (struct target_ops *ops,
> enum target_object object,
>
> if (record_insn_num == record_insn_max_num && record_insn_max_num)
> record_list_release_first ();
> - else
> - record_insn_num++;
> +
> + record_insn_num++;
> }
>
> return record_beneath_to_xfer_partial (record_beneath_to_xfer_partial_ops,
>
next prev parent reply other threads:[~2009-10-13 6:46 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 [this message]
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
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=daef60380910122346x7a0ffc10jcd7ce7f137e9028f@mail.gmail.com \
--to=teawater@gmail.com \
--cc=freephp@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.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