This is the mail archive of the gdb-patches@sources.redhat.com 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]

[commit] Fix ppc64 fpscr display in gdbserver


As per my question to Ulrich earlier: for S/390 registers are padded on the
right, which is logical if the value passed to ptrace is treated as a 64-bit
data buffer.  On PPC64 they're padded on the left, which is logical if the
value passed to ptrace is treated as a 64-bit integer.

Tested on powerpc64-linux and i386-linux and committed.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-07-13  Daniel Jacobowitz  <dan@codesourcery.com>

	* linux-low.c (fetch_register, usr_store_inferior_registers): Handle
	left-padded registers.
	* linux-low.h (struct linux_target_ops): Add left_pad_xfer.
	* linux-ppc64-low.c (the_low_target): Set left_pad_xfer.

Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.38
diff -u -p -r1.38 linux-low.c
--- linux-low.c	17 Jun 2005 04:01:05 -0000	1.38
+++ linux-low.c	13 Jul 2005 14:47:26 -0000
@@ -1126,7 +1126,12 @@ fetch_register (int regno)
 	  goto error_exit;
 	}
     }
-  supply_register (regno, buf);
+  if (the_low_target.left_pad_xfer
+      && register_size (regno) < sizeof (PTRACE_XFER_TYPE))
+    supply_register (regno, (buf + sizeof (PTRACE_XFER_TYPE)
+			     - register_size (regno)));
+  else
+    supply_register (regno, buf);
 
 error_exit:;
 }
@@ -1168,7 +1173,12 @@ usr_store_inferior_registers (int regno)
 	     & - sizeof (PTRACE_XFER_TYPE);
       buf = alloca (size);
       memset (buf, 0, size);
-      collect_register (regno, buf);
+      if (the_low_target.left_pad_xfer
+	  && register_size (regno) < sizeof (PTRACE_XFER_TYPE))
+	collect_register (regno, (buf + sizeof (PTRACE_XFER_TYPE)
+				  - register_size (regno)));
+      else
+	collect_register (regno, buf);
       for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
 	{
 	  errno = 0;
Index: linux-low.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.h,v
retrieving revision 1.10
diff -u -p -r1.10 linux-low.h
--- linux-low.h	13 Jun 2005 01:59:22 -0000	1.10
+++ linux-low.h	13 Jul 2005 14:47:26 -0000
@@ -64,6 +64,9 @@ struct linux_target_ops
   int (*stopped_by_watchpoint) (void);
   CORE_ADDR (*stopped_data_address) (void);
 
+  /* Whether to left-pad registers for PEEKUSR/POKEUSR if they are smaller
+     than an xfer unit.  */
+  int left_pad_xfer;
 };
 
 extern struct linux_target_ops the_low_target;
Index: linux-ppc64-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-ppc64-low.c,v
retrieving revision 1.3
diff -u -p -r1.3 linux-ppc64-low.c
--- linux-ppc64-low.c	13 Jun 2005 01:59:22 -0000	1.3
+++ linux-ppc64-low.c	13 Jul 2005 14:47:26 -0000
@@ -109,4 +109,9 @@ struct linux_target_ops the_low_target =
   NULL,
   0,
   ppc_breakpoint_at,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  1
 };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]