gdb.trace: Fix write_inferior_data_ptr on 32-bit big-endian machines.
authorMarcin Kościelnicki <koriakin@0x04.net>
Fri, 22 Jan 2016 13:25:02 +0000 (14:25 +0100)
committerMarcin Kościelnicki <koriakin@0x04.net>
Fri, 22 Jan 2016 14:03:47 +0000 (15:03 +0100)
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 *).

gdb/gdbserver/ChangeLog
gdb/gdbserver/tracepoint.c

index 9c42fcf97ff751bd4bbe1259af286dc062a3b8f1..6ddd9ce91a1dea4891bcd9cc1b85be106b5eb07a 100644 (file)
@@ -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.
index 40d0da93a6173479e227aec0c897e148673d5f5f..0671999ef90df3e6652e1def56ab711140c40389 100644 (file)
@@ -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