[OB] Rename some more variables called 'tmp' from i386_process_record

Michael Snyder msnyder@vmware.com
Mon Mar 8 18:08:00 GMT 2010


Mark Kettenis wrote:
>> Date: Sun, 07 Mar 2010 16:54:45 -0800
>> From: Michael Snyder <msnyder@vmware.com>
>>
>> Rename tmpu16, tmpu32 and tmpu64.
> 
> Whoa there!  Looking at how these variables are used, I just noticed
> that this code is broken:
> 
>> +	      uint32_t addr32;
>> +
>> +              if (target_read_memory (ir.addr, (gdb_byte *) &addr32, 4))
> 
> You're reading from target memory (which is little endian) into a
> 32-bit variable in host memory (which is big endian).  That's wrong!
> And the process record stuff is full of it.
> 
> Please fix this by reading into a gdb_byte buffer and using
> extract_{signed|unsigned}_integer(), or use
> read_memeory_{unsigned_}integer().


Yeah, I think you're right.

You understand, Hui?  We're just reading a number from target memory and
using it on the host.  We need to read it into a byte buffer, and use
extract_unsigned_integer to convert it.

We are only getting away with this because we only test when
host and target are the same.  If host were MIPS, this would
fail.




More information about the Gdb-patches mailing list