This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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().
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.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |