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]

[rfc] [05/14] Prepare arm targets


Hello,

this patch prepares the arm targets by adding REGCACHE arguments to
internal helper routines.

Also, the arnmnbsd-nat.c supply_gregset routine is not really an
instance of the global supply_gregset interface, it is just a
static routine.  To reduce confusion, I've renamed it (and its
companion supply_fparegset) to carry an arm_ prefix.

Bye,
Ulrich



ChangeLog:

	* arnmnbsd-nat.c (supply_gregset): Rename to ...
	(arm_supply_gregset): ... this.  Add REGCACHE parameter.
	Use it instead of current_regcache.
	(supply_fparegset): Rename to ...
	(arm_supply_fparegset): ... this.  Add REGCACHE parameter.
	Use it instead of current_regcache.
	(fetch_regs, fetch_fp_regs): Update calls.  Pass current_regcache.
	(fetch_core_registers, fetch_elfcore_registers): Likewise.


diff -urNp gdb-orig/gdb/armnbsd-nat.c gdb-head/gdb/armnbsd-nat.c
--- gdb-orig/gdb/armnbsd-nat.c	2007-04-28 03:08:35.179570447 +0200
+++ gdb-head/gdb/armnbsd-nat.c	2007-04-28 03:09:07.183824015 +0200
@@ -38,41 +38,41 @@
 extern int arm_apcs_32;
 
 static void
-supply_gregset (struct reg *gregset)
+arm_supply_gregset (struct regcache *regcache, struct reg *gregset)
 {
   int regno;
   CORE_ADDR r_pc;
 
   /* Integer registers.  */
   for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
-    regcache_raw_supply (current_regcache, regno, (char *) &gregset->r[regno]);
+    regcache_raw_supply (regcache, regno, (char *) &gregset->r[regno]);
 
-  regcache_raw_supply (current_regcache, ARM_SP_REGNUM,
+  regcache_raw_supply (regcache, ARM_SP_REGNUM,
 		       (char *) &gregset->r_sp);
-  regcache_raw_supply (current_regcache, ARM_LR_REGNUM,
+  regcache_raw_supply (regcache, ARM_LR_REGNUM,
 		       (char *) &gregset->r_lr);
   /* This is ok: we're running native...  */
   r_pc = ADDR_BITS_REMOVE (gregset->r_pc);
-  regcache_raw_supply (current_regcache, ARM_PC_REGNUM, (char *) &r_pc);
+  regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc);
 
   if (arm_apcs_32)
-    regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+    regcache_raw_supply (regcache, ARM_PS_REGNUM,
 			 (char *) &gregset->r_cpsr);
   else
-    regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+    regcache_raw_supply (regcache, ARM_PS_REGNUM,
 			 (char *) &gregset->r_pc);
 }
 
 static void
-supply_fparegset (struct fpreg *fparegset)
+arm_supply_fparegset (struct regcache *regcache, struct fpreg *fparegset)
 {
   int regno;
 
   for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
-    regcache_raw_supply (current_regcache, regno,
+    regcache_raw_supply (regcache, regno,
 			 (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
 
-  regcache_raw_supply (current_regcache, ARM_FPS_REGNUM,
+  regcache_raw_supply (regcache, ARM_FPS_REGNUM,
 		       (char *) &fparegset->fpr_fpsr);
 }
 
@@ -142,7 +142,7 @@ fetch_regs (void)
       return;
     }
 
-  supply_gregset (&inferior_registers);
+  arm_supply_gregset (current_regcache, &inferior_registers);
 }
 
 static void
@@ -190,7 +190,7 @@ fetch_fp_regs (void)
       return;
     }
 
-  supply_fparegset (&inferior_fp_registers);
+  arm_supply_fparegset (current_regcache, &inferior_fp_registers);
 }
 
 static void
@@ -421,8 +421,8 @@ fetch_core_registers (char *core_reg_sec
   int regno;
   CORE_ADDR r_pc;
 
-  supply_gregset (&core_reg->intreg);
-  supply_fparegset (&core_reg->freg);
+  arm_supply_gregset (current_regcache, &core_reg->intreg);
+  arm_supply_fparegset (current_regcache, &core_reg->freg);
 }
 
 static void
@@ -442,7 +442,7 @@ fetch_elfcore_registers (char *core_reg_
 	  /* The memcpy may be unnecessary, but we can't really be sure
 	     of the alignment of the data in the core file.  */
 	  memcpy (&gregset, core_reg_sect, sizeof (gregset));
-	  supply_gregset (&gregset);
+	  arm_supply_gregset (current_regcache, &gregset);
 	}
       break;
 
@@ -454,7 +454,7 @@ fetch_elfcore_registers (char *core_reg_
 	  /* The memcpy may be unnecessary, but we can't really be sure
 	     of the alignment of the data in the core file.  */
 	  memcpy (&fparegset, core_reg_sect, sizeof (fparegset));
-	  supply_fparegset (&fparegset);
+	  arm_supply_fparegset (current_regcache, &fparegset);
 	}
       break;
 
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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