Bug in i386_process_record?

Michael Snyder msnyder@vmware.com
Tue Aug 18 05:35:00 GMT 2009


Hui Zhu wrote:
> On Tue, Aug 11, 2009 at 05:57, Michael Snyder <msnyder@vmware.com> wrote:
>> Yes, this seems to be better.  It records only 4 bytes each time
>> it is called.
>>
>> But there seems to be still an off-by-one error?  With the test
>> program that I provided, we call memset with an argument of
>> 1024, but we actually record 1025 bytes... this code gets hit
>> 257 times, with the last time recording only 1 byte.
>>
>>
> 
> Hi Michael,
> 
> This issue is because:
> 
> 0xb7edf4e7 <memset+55>:	rep stos %eax,%es:(%edi)
> 0xb7edf4e9 <memset+57>:	mov    %edx,%ecx
> 0xb7edf4eb <memset+59>:	rep stos %al,%es:(%edi)
> 0xb7edf4ed <memset+61>:	mov    0x8(%esp),%eax
> 0xb7edf4f1 <memset+65>:	pop    %edi
> 
> If the memcpy size is not align with 4, it will handle by second rep stos.
> Then rep stos will not execute if %ecx is 0.
> i386_process_record doesn't check %ecx, so it get this error.
> 
> I make a new patch for it.  Please help me review it.

This seems much better.  Please give us a change log and post it for review.

By the way, I'm sorry, I only just realized that I posted two
completely different bug reports with the exact same subject line.
;-(

Cheers,
Michael



More information about the Gdb-patches mailing list