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: Tue, 13 Oct 2009 18:06:00 -0000 [thread overview]
Message-ID: <4AD4C07D.20502@vmware.com> (raw)
In-Reply-To: <daef60380910122346x7a0ffc10jcd7ce7f137e9028f@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
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:
[-- Attachment #2: insn_num2.txt --]
[-- Type: text/plain, Size: 1517 bytes --]
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-13 18:06 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 [this message]
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=4AD4C07D.20502@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