hppa-hpux-tdep.c: Fix host dependency.
$ make WERROR_CFLAGS="-Wpointer-sign -Werror" hppa-hpux-tdep.o -k 2>&1 1>/dev/null
../../src/gdb/hppa-hpux-tdep.c: In function ‘hppa_hpux_push_dummy_code’:
../../src/gdb/hppa-hpux-tdep.c:1225:7: error: pointer targets in passing argument 2 of ‘write_memory’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:22:0:
../../src/gdb/gdbcore.h:85:13: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’
../../src/gdb/hppa-hpux-tdep.c:1251:7: error: pointer targets in passing argument 2 of ‘write_memory’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:22:0:
../../src/gdb/gdbcore.h:85:13: note: expected ‘const gdb_byte *’ but argument is of type ‘char *’
../../src/gdb/hppa-hpux-tdep.c: In function ‘hppa_hpux_supply_save_state’:
../../src/gdb/hppa-hpux-tdep.c:1354:9: error: pointer targets in passing argument 1 of ‘extract_unsigned_integer’ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/hppa-hpux-tdep.c:20:0:
../../src/gdb/defs.h:675:22: note: expected ‘const gdb_byte *’ but argument is of type ‘const char *’
Casting to gdb_byte would fix it, however, writing an
unsigned int array like this
static unsigned int hppa64_tramp[] = {
0xeac0f000, /* bve,l (r22),%r2 */
0x0fdf12d1, /* std r31,-8(,sp) */
0x0fd110c2, /* ldd -8(,sp),rp */
0xe840d002, /* bve,n (rp) */
0x08000240 /* nop */
...
directly to target memory assumes the host endianness is the same as
the target's. hppa is big endian, so I believe this patch should be
correct -- it defines the array as a gdb_byte array. It uses a macro
to make the insn bytes a little more readable. I thought of using
write_memory_unsigned_integer once for each element of the unsigned
int array, but this way keeps issuing a single target memory write /
roundtrip for the whole trampoline.
gdb/
2013-03-22 Pedro Alves <palves@redhat.com>
* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Define INSN macro,
use it to rewrite the trampoline buffers with type gdb_byte[], and
undefine the macro. Remove char* cast.