[rfc] [04/14] Prepare alpha targets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[rfc] [04/14] Prepare alpha targets

Ulrich Weigand
Hello,

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

Bye,
Ulrich


ChangeLog:

        * alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs,
        alpha_supply_fp_regs, alpha_fill_fp_regs): Add REGCACHE parameter,
        use it instead of current_regcache.
        * alpha-tdep.h (struct regcache): Add forward declaration.
        (alpha_supply_int_regs, alpha_fill_int_regs, alpha_supply_fp_regs,
        alpha_fill_fp_regs): Update prototypes.

        * alpha-nat.c: (supply_gregset, fill_gregset, supply_fpregset,
        fill_fpregset): Pass current_regcache to alpha_supply/fill_ routines.
        * alpha-linux-nat.c: Include "regcache.h".
        (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Pass
        current_regcache to alpha_supply/fill_ routines.

        * alphabsd-tdep.c: Include "regcache.h".
        (alphabsd_supply_reg, alphabsd_supply_fpreg): Add REGCACHE paramter,
        pass it to alpha_supply_ routines.  Make REGS const.
        (alphabsd_fill_reg, alphabsd_fill_fpreg): Add REGCACHE parameter,
        pass it to alpha_fill_ routines.
        * alphabsd-tdep.h (struct regcache): Add forward declaration.
        (alphabsd_supply_reg, alphabsd_fill_reg, alphabsd_supply_fpreg,
        alphabsd_fill_fpreg): Update prototypes.

        * alphanbsd-nat.c (supply_gregset, fill_gregset, supply_fpregset,
        fill_fpregset, alphabsd_fetch_inferior_registers,
        alphabsd_store_inferior_registers): Pass current_regcache to
        alphabsd_supply/fill_ routines.

        * Makefile.in (alpha-linux-nat.o, alphabsd-tdep.o): Update
        dependencies.


diff -urNp gdb-orig/gdb/alphabsd-nat.c gdb-head/gdb/alphabsd-nat.c
--- gdb-orig/gdb/alphabsd-nat.c 2007-04-28 17:27:50.133112000 +0200
+++ gdb-head/gdb/alphabsd-nat.c 2007-04-28 19:16:55.826755007 +0200
@@ -52,25 +52,25 @@ typedef struct fpreg fpregset_t;
 void
 supply_gregset (gregset_t *gregsetp)
 {
-  alphabsd_supply_reg ((char *) gregsetp, -1);
+  alphabsd_supply_reg (current_regcache, (char *) gregsetp, -1);
 }
 
 void
 fill_gregset (gregset_t *gregsetp, int regno)
 {
-  alphabsd_fill_reg ((char *) gregsetp, regno);
+  alphabsd_fill_reg (current_regcache, (char *) gregsetp, regno);
 }
 
 void
 supply_fpregset (fpregset_t *fpregsetp)
 {
-  alphabsd_supply_fpreg ((char *) fpregsetp, -1);
+  alphabsd_supply_fpreg (current_regcache, (char *) fpregsetp, -1);
 }
 
 void
 fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
-  alphabsd_fill_fpreg ((char *) fpregsetp, regno);
+  alphabsd_fill_fpreg (current_regcache, (char *) fpregsetp, regno);
 }
 
 /* Determine if PT_GETREGS fetches this register.  */
@@ -96,7 +96,7 @@ alphabsd_fetch_inferior_registers (int r
   (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
  perror_with_name (_("Couldn't get registers"));
 
-      alphabsd_supply_reg ((char *) &gregs, regno);
+      alphabsd_supply_reg (current_regcache, (char *) &gregs, regno);
       if (regno != -1)
  return;
     }
@@ -109,7 +109,7 @@ alphabsd_fetch_inferior_registers (int r
   (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
  perror_with_name (_("Couldn't get floating point status"));
 
-      alphabsd_supply_fpreg ((char *) &fpregs, regno);
+      alphabsd_supply_fpreg (current_regcache, (char *) &fpregs, regno);
     }
 }
 
@@ -126,7 +126,7 @@ alphabsd_store_inferior_registers (int r
                   (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
         perror_with_name (_("Couldn't get registers"));
 
-      alphabsd_fill_reg ((char *) &gregs, regno);
+      alphabsd_fill_reg (current_regcache, (char *) &gregs, regno);
 
       if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
                   (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
@@ -144,7 +144,7 @@ alphabsd_store_inferior_registers (int r
   (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
  perror_with_name (_("Couldn't get floating point status"));
 
-      alphabsd_fill_fpreg ((char *) &fpregs, regno);
+      alphabsd_fill_fpreg (current_regcache, (char *) &fpregs, regno);
 
       if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
   (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
diff -urNp gdb-orig/gdb/alphabsd-tdep.c gdb-head/gdb/alphabsd-tdep.c
--- gdb-orig/gdb/alphabsd-tdep.c 2007-04-28 17:27:50.137111000 +0200
+++ gdb-head/gdb/alphabsd-tdep.c 2007-04-28 19:16:55.830754439 +0200
@@ -20,6 +20,7 @@
    Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
+#include "regcache.h"
 
 #include "alpha-tdep.h"
 #include "alphabsd-tdep.h"
@@ -28,29 +29,29 @@
    ptrace register structure used by BSD on Alpha.  */
 
 void
-alphabsd_supply_reg (char *regs, int regno)
+alphabsd_supply_reg (struct regcache *regcache, const char *regs, int regno)
 {
   /* PC is at slot 32; UNIQUE not present.  */
-  alpha_supply_int_regs (regno, regs, regs + 31 * 8, NULL);
+  alpha_supply_int_regs (regcache, regno, regs, regs + 31 * 8, NULL);
 }
 
 void
-alphabsd_fill_reg (char *regs, int regno)
+alphabsd_fill_reg (const struct regcache *regcache, char *regs, int regno)
 {
   /* PC is at slot 32; UNIQUE not present.  */
-  alpha_fill_int_regs (regno, regs, regs + 31 * 8, NULL);
+  alpha_fill_int_regs (regcache, regno, regs, regs + 31 * 8, NULL);
 }
 
 void
-alphabsd_supply_fpreg (char *fpregs, int regno)
+alphabsd_supply_fpreg (struct regcache *regcache, const char *fpregs, int regno)
 {
   /* FPCR is at slot 33; slot 32 unused.  */
-  alpha_supply_fp_regs (regno, fpregs, fpregs + 32 * 8);
+  alpha_supply_fp_regs (regcache, regno, fpregs, fpregs + 32 * 8);
 }
 
 void
-alphabsd_fill_fpreg (char *fpregs, int regno)
+alphabsd_fill_fpreg (const struct regcache *regcache, char *fpregs, int regno)
 {
   /* FPCR is at slot 33; slot 32 unused.  */
-  alpha_fill_fp_regs (regno, fpregs, fpregs + 32 * 8);
+  alpha_fill_fp_regs (regcache, regno, fpregs, fpregs + 32 * 8);
 }
diff -urNp gdb-orig/gdb/alphabsd-tdep.h gdb-head/gdb/alphabsd-tdep.h
--- gdb-orig/gdb/alphabsd-tdep.h 2007-04-28 17:27:50.140111000 +0200
+++ gdb-head/gdb/alphabsd-tdep.h 2007-04-28 19:16:55.834753870 +0200
@@ -22,11 +22,13 @@
 #ifndef ALPHABSD_TDEP_H
 #define ALPHABSD_TDEP_H
 
-void alphabsd_supply_reg (char *, int);
-void alphabsd_fill_reg (char *, int);
+struct regcache;
 
-void alphabsd_supply_fpreg (char *, int);
-void alphabsd_fill_fpreg (char *, int);
+void alphabsd_supply_reg (struct regcache *, const char *, int);
+void alphabsd_fill_reg (const struct regcache *, char *, int);
+
+void alphabsd_supply_fpreg (struct regcache *, const char *, int);
+void alphabsd_fill_fpreg (const struct regcache *, char *, int);
 
 
 /* Functions exported from alphanbsd-tdep.c.  */
diff -urNp gdb-orig/gdb/alpha-linux-nat.c gdb-head/gdb/alpha-linux-nat.c
--- gdb-orig/gdb/alpha-linux-nat.c 2007-04-28 19:17:04.356870721 +0200
+++ gdb-head/gdb/alpha-linux-nat.c 2007-04-28 19:16:55.838753301 +0200
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "target.h"
+#include "regcache.h"
 #include "linux-nat.h"
 
 #include "alpha-tdep.h"
@@ -44,7 +45,7 @@ supply_gregset (gdb_gregset_t *gregsetp)
   long *regp = (long *)gregsetp;
 
   /* PC is in slot 32, UNIQUE is in slot 33.  */
-  alpha_supply_int_regs (-1, regp, regp + 31, regp + 32);
+  alpha_supply_int_regs (current_regcache, -1, regp, regp + 31, regp + 32);
 }
 
 void
@@ -53,7 +54,7 @@ fill_gregset (gdb_gregset_t *gregsetp, i
   long *regp = (long *)gregsetp;
 
   /* PC is in slot 32, UNIQUE is in slot 33.  */
-  alpha_fill_int_regs (regno, regp, regp + 31, regp + 32);
+  alpha_fill_int_regs (current_regcache, regno, regp, regp + 31, regp + 32);
 }
 
 /*
@@ -67,7 +68,7 @@ supply_fpregset (gdb_fpregset_t *fpregse
   long *regp = (long *)fpregsetp;
 
   /* FPCR is in slot 32.  */
-  alpha_supply_fp_regs (-1, regp, regp + 31);
+  alpha_supply_fp_regs (current_regcache, -1, regp, regp + 31);
 }
 
 void
@@ -76,7 +77,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
   long *regp = (long *)fpregsetp;
 
   /* FPCR is in slot 32.  */
-  alpha_fill_fp_regs (regno, regp, regp + 31);
+  alpha_fill_fp_regs (current_regcache, regno, regp, regp + 31);
 }
 
 
diff -urNp gdb-orig/gdb/alpha-nat.c gdb-head/gdb/alpha-nat.c
--- gdb-orig/gdb/alpha-nat.c 2007-04-28 19:17:04.361870010 +0200
+++ gdb-head/gdb/alpha-nat.c 2007-04-28 19:16:55.843752589 +0200
@@ -158,7 +158,7 @@ supply_gregset (gdb_gregset_t *gregsetp)
   long *regp = gregsetp->regs;
 
   /* PC is in slot 32.  */
-  alpha_supply_int_regs (-1, regp, regp + 31, NULL);
+  alpha_supply_int_regs (current_regcache, -1, regp, regp + 31, NULL);
 }
 
 void
@@ -167,7 +167,7 @@ fill_gregset (gdb_gregset_t *gregsetp, i
   long *regp = gregsetp->regs;
 
   /* PC is in slot 32.  */
-  alpha_fill_int_regs (regno, regp, regp + 31, NULL);
+  alpha_fill_int_regs (current_regcache, regno, regp, regp + 31, NULL);
 }
 
 /*
@@ -181,7 +181,7 @@ supply_fpregset (gdb_fpregset_t *fpregse
   long *regp = fpregsetp->regs;
 
   /* FPCR is in slot 32.  */
-  alpha_supply_fp_regs (-1, regp, regp + 31);
+  alpha_supply_fp_regs (current_regcache, -1, regp, regp + 31);
 }
 
 void
@@ -190,7 +190,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
   long *regp = fpregsetp->regs;
 
   /* FPCR is in slot 32.  */
-  alpha_fill_fp_regs (regno, regp, regp + 31);
+  alpha_fill_fp_regs (current_regcache, regno, regp, regp + 31);
 }
 #endif
 
diff -urNp gdb-orig/gdb/alpha-tdep.c gdb-head/gdb/alpha-tdep.c
--- gdb-orig/gdb/alpha-tdep.c 2007-04-28 17:27:50.157108000 +0200
+++ gdb-head/gdb/alpha-tdep.c 2007-04-28 19:16:55.850751594 +0200
@@ -1296,71 +1296,74 @@ alpha_unwind_pc (struct gdbarch *gdbarch
    targets don't supply this value in their core files.  */
 
 void
-alpha_supply_int_regs (int regno, const void *r0_r30,
-       const void *pc, const void *unique)
+alpha_supply_int_regs (struct regcache *regcache, int regno,
+       const void *r0_r30, const void *pc, const void *unique)
 {
   const gdb_byte *regs = r0_r30;
   int i;
 
   for (i = 0; i < 31; ++i)
     if (regno == i || regno == -1)
-      regcache_raw_supply (current_regcache, i, regs + i * 8);
+      regcache_raw_supply (regcache, i, regs + i * 8);
 
   if (regno == ALPHA_ZERO_REGNUM || regno == -1)
-    regcache_raw_supply (current_regcache, ALPHA_ZERO_REGNUM, NULL);
+    regcache_raw_supply (regcache, ALPHA_ZERO_REGNUM, NULL);
 
   if (regno == ALPHA_PC_REGNUM || regno == -1)
-    regcache_raw_supply (current_regcache, ALPHA_PC_REGNUM, pc);
+    regcache_raw_supply (regcache, ALPHA_PC_REGNUM, pc);
 
   if (regno == ALPHA_UNIQUE_REGNUM || regno == -1)
-    regcache_raw_supply (current_regcache, ALPHA_UNIQUE_REGNUM, unique);
+    regcache_raw_supply (regcache, ALPHA_UNIQUE_REGNUM, unique);
 }
 
 void
-alpha_fill_int_regs (int regno, void *r0_r30, void *pc, void *unique)
+alpha_fill_int_regs (const struct regcache *regcache,
+     int regno, void *r0_r30, void *pc, void *unique)
 {
   gdb_byte *regs = r0_r30;
   int i;
 
   for (i = 0; i < 31; ++i)
     if (regno == i || regno == -1)
-      regcache_raw_collect (current_regcache, i, regs + i * 8);
+      regcache_raw_collect (regcache, i, regs + i * 8);
 
   if (regno == ALPHA_PC_REGNUM || regno == -1)
-    regcache_raw_collect (current_regcache, ALPHA_PC_REGNUM, pc);
+    regcache_raw_collect (regcache, ALPHA_PC_REGNUM, pc);
 
   if (unique && (regno == ALPHA_UNIQUE_REGNUM || regno == -1))
-    regcache_raw_collect (current_regcache, ALPHA_UNIQUE_REGNUM, unique);
+    regcache_raw_collect (regcache, ALPHA_UNIQUE_REGNUM, unique);
 }
 
 void
-alpha_supply_fp_regs (int regno, const void *f0_f30, const void *fpcr)
+alpha_supply_fp_regs (struct regcache *regcache, int regno,
+      const void *f0_f30, const void *fpcr)
 {
   const gdb_byte *regs = f0_f30;
   int i;
 
   for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
     if (regno == i || regno == -1)
-      regcache_raw_supply (current_regcache, i,
+      regcache_raw_supply (regcache, i,
    regs + (i - ALPHA_FP0_REGNUM) * 8);
 
   if (regno == ALPHA_FPCR_REGNUM || regno == -1)
-    regcache_raw_supply (current_regcache, ALPHA_FPCR_REGNUM, fpcr);
+    regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, fpcr);
 }
 
 void
-alpha_fill_fp_regs (int regno, void *f0_f30, void *fpcr)
+alpha_fill_fp_regs (const struct regcache *regcache,
+    int regno, void *f0_f30, void *fpcr)
 {
   gdb_byte *regs = f0_f30;
   int i;
 
   for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
     if (regno == i || regno == -1)
-      regcache_raw_collect (current_regcache, i,
+      regcache_raw_collect (regcache, i,
     regs + (i - ALPHA_FP0_REGNUM) * 8);
 
   if (regno == ALPHA_FPCR_REGNUM || regno == -1)
-    regcache_raw_collect (current_regcache, ALPHA_FPCR_REGNUM, fpcr);
+    regcache_raw_collect (regcache, ALPHA_FPCR_REGNUM, fpcr);
 }
 
 
diff -urNp gdb-orig/gdb/alpha-tdep.h gdb-head/gdb/alpha-tdep.h
--- gdb-orig/gdb/alpha-tdep.h 2007-04-28 17:27:50.199103000 +0200
+++ gdb-head/gdb/alpha-tdep.h 2007-04-28 19:16:55.893745478 +0200
@@ -22,6 +22,8 @@
 #ifndef ALPHA_TDEP_H
 #define ALPHA_TDEP_H
 
+struct regcache;
+
 /* Say how long (ordinary) registers are.  This is a piece of bogosity
    used in push_word and a few other places; register_size() is the
    real way to know how big a register is.  */
@@ -113,10 +115,13 @@ extern CORE_ADDR alpha_after_prologue (C
 extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
 extern void alpha_dwarf2_init_abi (struct gdbarch_info, struct gdbarch *);
 
-extern void alpha_supply_int_regs (int, const void *, const void *,
-   const void *);
-extern void alpha_fill_int_regs (int, void *, void *, void *);
-extern void alpha_supply_fp_regs (int, const void *, const void *);
-extern void alpha_fill_fp_regs (int, void *, void *);
+extern void alpha_supply_int_regs (struct regcache *, int, const void *,
+   const void *, const void *);
+extern void alpha_fill_int_regs (const struct regcache *, int,
+ void *, void *, void *);
+extern void alpha_supply_fp_regs (struct regcache *, int,
+  const void *, const void *);
+extern void alpha_fill_fp_regs (const struct regcache *,
+ int, void *, void *);
 
 #endif /* ALPHA_TDEP_H */
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in 2007-04-28 18:45:13.412770000 +0200
+++ gdb-head/gdb/Makefile.in 2007-04-28 19:16:55.904743913 +0200
@@ -1712,12 +1712,12 @@ aix-thread.o: aix-thread.c $(defs_h) $(g
 alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
  $(alpha_tdep_h) $(alphabsd_tdep_h) $(inf_ptrace_h) $(gregset_h) \
  $(bsd_kvm_h)
-alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(alpha_tdep_h) \
+alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \
  $(alphabsd_tdep_h)
 alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(osabi_h) \
  $(alpha_tdep_h) $(solib_svr4_h)
-alpha-linux-nat.o: alpha-linux-nat.c $(defs_h) $(target_h) $(linux_nat_h) \
- $(alpha_tdep_h) $(gregset_h)
+alpha-linux-nat.o: alpha-linux-nat.c $(defs_h) $(target_h) $(regcache_h) \
+ $(linux_nat_h) $(alpha_tdep_h) $(gregset_h)
 alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdb_assert_h) \
  $(gdb_string_h) $(osabi_h) $(solib_svr4_h) $(symtab_h) $(regset_h) \
  $(regcache_h) $(alpha_tdep_h)
--
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  [hidden email]