This is the mail archive of the gdb-patches@sourceware.org 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]

[RFA] NetBSD, mipsnbsd-tdep.c supply_gregset 32/64


Similar to yesterday's patch, this one accounts for core files.

2007-12-13  Michael Snyder  <msnyder@specifix.com>

	* mipsnbsd-tdep.c (mipsnbsd_supply_gregset): Convert 32/64 bits, 
	for targets in which mips_abi_size != mips_isa_size.

Index: mipsnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsnbsd-tdep.c,v
retrieving revision 1.32
diff -u -p -r1.32 mipsnbsd-tdep.c
--- mipsnbsd-tdep.c	16 Nov 2007 04:56:45 -0000	1.32
+++ mipsnbsd-tdep.c	14 Dec 2007 00:22:43 -0000
@@ -81,22 +81,31 @@ mipsnbsd_supply_gregset (const struct re
 			 struct regcache *regcache, int regnum,
 			 const void *gregs, size_t len)
 {
-  size_t regsize = mips_isa_regsize (get_regcache_arch (regcache));
+  size_t abisize = mips_abi_regsize (get_regcache_arch (regcache));
   const char *regs = gregs;
   int i;
 
-  gdb_assert (len >= MIPSNBSD_NUM_GREGS * regsize);
+  gdb_assert (len >= MIPSNBSD_NUM_GREGS * abisize);
 
-  for (i = 0; i <= MIPS_PC_REGNUM; i++)
+  for (i = 0; i <= MIPSFBSD_NUM_GREGS; i++)
     {
       if (regnum == i || regnum == -1)
-	regcache_raw_supply (regcache, i, regs + i * regsize);
+	{
+	  size_t isasize = register_size (current_gdbarch, i);
+	  void *addr = regs + i * abisize;
+	  gdb_byte buf[MAX_REGISTER_SIZE];
+	  LONGEST val;
+
+	  val = extract_signed_integer (addr, abisize);
+	  store_signed_integer (buf, isasize, val);
+	  regcache_raw_supply (regcache, i, buf);
+	}
     }
 
-  if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * regsize)
+  if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * abisize)
     {
-      regs += MIPSNBSD_NUM_GREGS * regsize;
-      len -= MIPSNBSD_NUM_GREGS * regsize;
+      regs += MIPSNBSD_NUM_GREGS * abisize;
+      len -= MIPSNBSD_NUM_GREGS * abisize;
       mipsnbsd_supply_fpregset (regset, regcache, regnum, regs, len);
     }
 }



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