[parisc-linux-cvs] gdb amodra

Alan Modra alan@linuxcare.com.au
Mon, 9 Apr 2001 23:07:52 +1000 (EST)


On Mon, 9 Apr 2001, Alan Modra wrote:

> tweak address calculation of ptrace register offset to allow
> a 64-bit pt_regs / ptrace interface to be used for 32 bit processes.

This shouldn't do anything at the moment as gdb gets compiled with the 32
bit kernel version of asm/offset.h, but now we should be ready for an
upgrade to a 64 bit pt_regs.

-- 
Alan Modra

Index: pa-linux-nat.c
===================================================================
RCS file: /home/cvs/parisc/gdb/gdb/pa-linux-nat.c,v
retrieving revision 1.6
diff -u -p -r1.6 pa-linux-nat.c
--- pa-linux-nat.c	2001/03/23 15:10:59	1.6
+++ pa-linux-nat.c	2001/04/09 12:53:22
@@ -160,7 +160,13 @@ register_addr (int regno, CORE_ADDR bloc
   if (u_offsets[regno] == -1)
     addr = 0;
   else
-    addr = (CORE_ADDR) u_offsets[regno];
+    {
+      addr = (CORE_ADDR) u_offsets[regno];
+      /* If this is a 64 bit kernel, but we are debugging a 32 bit
+	 task, then we want to pick up the low word of the register.  */
+      if (PT_GR2 - PT_GR1 == 8 && regno < PA_FR0_REGNUM)
+	addr += (PT_GR2 - PT_GR1) - REGISTER_RAW_SIZE (regno);
+    }
 
   return addr;
 }
@@ -258,8 +264,8 @@ supply_gregset (gdb_gregset_t *gregsetp)
   for (i = 0; i < sizeof (greg_map) / sizeof (greg_map[0]); i++, regp++)
     {
       int regno = greg_map[i];
-      /* Gross.  A greg_t may be larger than the actual register, so
-	 just pick off the LS bits of big-endian word.  */
+      /* When running a 64 bit kernel, a greg_t may be larger than the
+	 actual register, so just pick off the LS bits of big-endian word.  */
       supply_register (regno,
 		       ((char *) (regp + 1)) - REGISTER_RAW_SIZE (regno));
     }