diff options
author | Marcin Kościelnicki <koriakin@0x04.net> | 2016-01-22 14:25:02 +0100 |
---|---|---|
committer | Marcin Kościelnicki <koriakin@0x04.net> | 2016-01-22 15:03:47 +0100 |
commit | 99e8eb11cfcdde8cba6755ed4613c3cb079dfaa4 (patch) | |
tree | 3688c8cb80ceaedd69b47088ba15e675603be667 | |
parent | 1ac78c044471fa65b952c2e5c47dcf4d0ccf9b79 (diff) | |
download | gdb-99e8eb11cfcdde8cba6755ed4613c3cb079dfaa4.zip gdb-99e8eb11cfcdde8cba6755ed4613c3cb079dfaa4.tar.gz gdb-99e8eb11cfcdde8cba6755ed4613c3cb079dfaa4.tar.bz2 |
gdb.trace: Fix write_inferior_data_ptr on 32-bit big-endian machines.
Noticed and tested on 31-bit s390. This bug caused completely broken
fast tracepoints.
gdb/gdbserver/ChangeLog:
* tracepoint.c (write_inferior_data_ptr): Cast to uintptr_t, so that
it works properly on big-endian machines where sizeof (CORE_ADDR)
!= sizeof (void *).
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/tracepoint.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 9c42fcf..6ddd9ce 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2016-01-22 Marcin Kościelnicki <koriakin@0x04.net> + + * tracepoint.c (write_inferior_data_ptr): Cast to uintptr_t, so that + it works properly on big-endian machines where sizeof (CORE_ADDR) + != sizeof (void *). + 2016-01-21 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER_CFLAGS, CXXFLAGS): New. diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 40d0da9..0671999 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -5931,14 +5931,15 @@ compile_tracepoint_condition (struct tracepoint *tpoint, *jump_entry += 16; } -/* We'll need to adjust these when we consider bi-arch setups, and big - endian machines. */ +/* We'll need to adjust these when we consider bi-arch setups. */ static int write_inferior_data_ptr (CORE_ADDR where, CORE_ADDR ptr) { + uintptr_t pptr = ptr; + return write_inferior_memory (where, - (unsigned char *) &ptr, sizeof (void *)); + (unsigned char *) &pptr, sizeof pptr); } /* The base pointer of the IPA's heap. This is the only memory the |