Re: Bug in i386_process_record?

Hui Zhu
2009-08-23T04:30:08Z

On Sun, Aug 23, 2009 at 12:07, Michael Snyder<msnyder@vmware.com> wrote:
> Hui Zhu wrote:
>>
>> On Sun, Aug 23, 2009 at 11:07, Michael Snyder<msnyder@vmware.com> wrote:
>>>
>>> Hi, please *don't* check this in -- I found a problem with it.
>>>
>>> Try running it with "set debug record 1" during the recording pass.
>>>
>>> I see a whole lot of these:
>>>
>>> Process record ignores the memory change of instruction at address
>>> 0x0x587be9 because it can't get the value of the segment register.
>>
>>
>> Hi Michael,
>>
>> Most of the string ops instruction will use segment register.
>> But I check the some linux program that have string ops insn.  I found
>> that in linux (maybe glibc), the value of the segment register is 0,
>> so it will not affect anything.
>
> Hmm, ok, but this is i386-tdep.c, not i386-linux-tdep.c...
>
>> And in linux user level, looks we don't have any good way to get the
>> value of the segment register.
>>
>> So I think this patch is OK.
>
> I see -- so, we don't really "ignore" the memory change at all.
>
> Isn't the message misleading, then?
>
> What about something like:
>
> @@ -4458,11 +4458,12 @@ reswitch:
>           if (ir.aflag)
>             {
>               /* 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"),
> +              if (record_debug &&
> +                 read_register (I386_ES_REGNUM) != 0)
> +                printf_unfiltered (_("Process record ignores value of ES "
> +                                     "register for instruction at address
> %s "
> +                                     "because "it can't get the value of "
> +                                     "the segment register.\n"),
>                                    paddress (gdbarch, ir.addr));
>             }
>           if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
>

read_register (I386_ES_REGNUM)
This value is not the value of ES. This is number of TLB. So ....

Hui