Re: Bug in i386_process_record?

Michael Snyder
2009-08-23T17:37:47Z

Hui Zhu wrote:
> 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 ....

So... what? I don't know about these things.
I'm just asking, could the message be more informative or accurate than
it is?

The message seems to say "ignores the memory change", which to me
implies "does not record the memory change". Yet the code seems
to imply that it *does* record the memory change, it just ignores
the ES offset.