From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Bug in i386_process_record?
Date: Thu, 27 Aug 2009 00:05:00 -0000 [thread overview]
Message-ID: <4A95C927.8020607@vmware.com> (raw)
In-Reply-To: <daef60380908251958u31f379e2oe5839c3a9e826428@mail.gmail.com>
Hui Zhu wrote:
> On Wed, Aug 26, 2009 at 02:42, Eli Zaretskii<eliz@gnu.org> wrote:
>>> From: Hui Zhu <teawater@gmail.com>
>>> Date: Tue, 25 Aug 2009 13:02:44 +0800
>>> Cc: msnyder@vmware.com, gdb-patches@sourceware.org
>>>
>>> It seems that the segment (It is not the section) registers in x86
>>> protect mode is just help MMU to get the physical address. It's
>>> transparent for the user level program.
>> It's transparent if $es and $ds have the same value (which they
>> usually do, AFAIK).
>>
>>> What do you think about remove this warning from this patch?
>> I would indeed do that, if we find that $es and $ds have the same
>> values. Assuming that someone who knows Linux better than I do
>> confirms that these two registers hold the same selector when a normal
>> application is running in user mode.
>>
>
> Thanks for remind me. We cannot get the value of each segment
> register, but we can get each segment register point to. So if the
> value of segment registers, it's means that the value of them is same.
>
> I add some code about it:
> regcache_raw_read_unsigned (ir.regcache,
> ir.regmap[X86_RECORD_ES_REGNUM],
> &es);
> regcache_raw_read_unsigned (ir.regcache,
> ir.regmap[X86_RECORD_DS_REGNUM],
> &ds);
> if (ir.aflag && (es != ds))
> {
>
> After that, we will not get the warning because the es is same with ds
> in user level.
>
> What do you think about it?
I think it is the best version I have seen so far.
And it seems to follow the conclusions of the discussion.
And I've tested it, and it seems to work.
I would say wait until end-of-business Friday, and
if there are no more comments, check it in!
Michael
> 2009-08-26 Hui Zhu <teawater@gmail.com>
>
> * i386-tdep.c (i386_process_record): Fix the error of string
> ops instructions's handler.
> ---
> i386-tdep.c | 69 ++++++++++++++++++++++++++++--------------------------------
> 1 file changed, 33 insertions(+), 36 deletions(-)
>
> --- a/i386-tdep.c
> +++ b/i386-tdep.c
> @@ -4441,50 +4441,47 @@ reswitch:
> /* insS */
> case 0x6c:
> case 0x6d:
> - if ((opcode & 1) == 0)
> - ir.ot = OT_BYTE;
> - else
> - ir.ot = ir.dflag + OT_WORD;
> regcache_raw_read_unsigned (ir.regcache,
> - ir.regmap[X86_RECORD_REDI_REGNUM],
> + ir.regmap[X86_RECORD_RECX_REGNUM],
> &tmpulongest);
> - if (!ir.aflag)
> - {
> - tmpulongest &= 0xffff;
> - /* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
> - if (record_debug)
> - printf_unfiltered (_("Process record ignores the memory change "
> - "of instruction at address 0x%s because "
> - "it can't get the value of the segment "
> - "register.\n"),
> - paddress (gdbarch, ir.addr));
> - }
> - if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
> + if (tmpulongest)
> {
> - ULONGEST count, eflags;
> + ULONGEST es, ds;
> +
> + if ((opcode & 1) == 0)
> + ir.ot = OT_BYTE;
> + else
> + ir.ot = ir.dflag + OT_WORD;
> regcache_raw_read_unsigned (ir.regcache,
> ir.regmap[X86_RECORD_REDI_REGNUM],
> - &count);
> - if (!ir.aflag)
> - count &= 0xffff;
> + &tmpulongest);
> +
> regcache_raw_read_unsigned (ir.regcache,
> - ir.regmap[X86_RECORD_EFLAGS_REGNUM],
> - &eflags);
> - if ((eflags >> 10) & 0x1)
> - tmpulongest -= (count - 1) * (1 << ir.ot);
> - if (record_arch_list_add_mem (tmpulongest, count * (1 << ir.ot)))
> - return -1;
> - I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
> - }
> - else
> - {
> + ir.regmap[X86_RECORD_ES_REGNUM],
> + &es);
> + regcache_raw_read_unsigned (ir.regcache,
> + ir.regmap[X86_RECORD_DS_REGNUM],
> + &ds);
> + if (ir.aflag && (es != ds))
> + {
> + /* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
> + if (record_debug)
> + printf_unfiltered (_("Process record ignores the memory "
> + "change of instruction at address 0x%s "
> + "because it can't get the value of the "
> + "ES segment register.\n"),
> + paddress (gdbarch, ir.addr));
> + }
> +
> + if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
> + I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
> if (record_arch_list_add_mem (tmpulongest, 1 << ir.ot))
> return -1;
> - }
> - if (opcode == 0xa4 || opcode == 0xa5)
> - I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
> - I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
> - I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
> + if (opcode == 0xa4 || opcode == 0xa5)
> + I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
> + I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
> + I386_RECORD_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
> + }
> break;
>
> /* cmpsS */
next prev parent reply other threads:[~2009-08-26 23:45 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A7BA1DE.6010103@vmware.com>
2009-08-10 9:33 ` Hui Zhu
2009-08-10 22:12 ` Michael Snyder
2009-08-11 6:20 ` Hui Zhu
2009-08-11 18:31 ` Hui Zhu
2009-08-16 16:12 ` Hui Zhu
2009-08-18 5:35 ` Michael Snyder
2009-08-18 11:52 ` Hui Zhu
2009-08-21 3:23 ` Hui Zhu
2009-08-23 3:15 ` Michael Snyder
2009-08-23 3:33 ` Hui Zhu
2009-08-23 4:13 ` Michael Snyder
2009-08-23 9:04 ` Hui Zhu
2009-08-23 17:37 ` Hui Zhu
2009-08-23 18:23 ` Michael Snyder
2009-08-23 18:32 ` Eli Zaretskii
2009-08-23 23:53 ` Hui Zhu
2009-08-23 23:56 ` Daniel Jacobowitz
2009-08-24 0:01 ` Hui Zhu
2009-08-24 7:46 ` Eli Zaretskii
2009-08-24 3:15 ` Hui Zhu
2009-08-24 19:20 ` Eli Zaretskii
2009-08-25 5:04 ` Hui Zhu
2009-08-25 18:45 ` Eli Zaretskii
2009-08-26 3:19 ` Hui Zhu
2009-08-26 3:27 ` Eli Zaretskii
2009-08-26 7:20 ` Hui Zhu
2009-08-26 17:37 ` Eli Zaretskii
2009-08-27 0:05 ` Michael Snyder [this message]
2009-08-27 0:32 ` Michael Snyder
2009-08-27 1:50 ` Hui Zhu
2009-08-27 15:35 ` Hui Zhu
2009-08-28 1:44 ` Michael Snyder
2009-08-28 2:14 ` Hui Zhu
2009-08-28 6:16 ` Michael Snyder
2009-08-28 8:46 ` Hui Zhu
2009-08-30 1:12 ` Michael Snyder
2009-08-27 1:44 ` Hui Zhu
2009-08-29 6:51 ` Hui Zhu
2009-08-24 20:31 ` Eli Zaretskii
2009-08-25 6:53 ` Hui Zhu
2009-08-23 18:24 ` Eli Zaretskii
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=4A95C927.8020607@vmware.com \
--to=msnyder@vmware.com \
--cc=eliz@gnu.org \
--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