summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog68
-rw-r--r--gdb/Makefile.in6
-rw-r--r--gdb/alpha-linux-nat.c22
-rw-r--r--gdb/alpha-nat.c22
-rw-r--r--gdb/alphabsd-nat.c16
-rw-r--r--gdb/amd64-linux-nat.c18
-rw-r--r--gdb/arm-linux-nat.c18
-rw-r--r--gdb/core-regset.c5
-rw-r--r--gdb/gregset.h20
-rw-r--r--gdb/hppa-linux-nat.c27
-rw-r--r--gdb/i386-linux-nat.c46
-rw-r--r--gdb/i386-sol2-nat.c18
-rw-r--r--gdb/i386gnu-nat.c9
-rw-r--r--gdb/i386v4-nat.c20
-rw-r--r--gdb/ia64-linux-nat.c69
-rw-r--r--gdb/irix5-nat.c56
-rw-r--r--gdb/linux-nat.c6
-rw-r--r--gdb/m32r-linux-nat.c28
-rw-r--r--gdb/m68klinux-nat.c51
-rw-r--r--gdb/mips-linux-nat.c26
-rw-r--r--gdb/ppc-linux-nat.c35
-rw-r--r--gdb/proc-service.c11
-rw-r--r--gdb/procfs.c15
-rw-r--r--gdb/s390-nat.c30
-rw-r--r--gdb/sol-thread.c16
-rw-r--r--gdb/sparc-linux-nat.c16
-rw-r--r--gdb/sparc-sol2-nat.c16
-rw-r--r--gdb/sparc64-linux-nat.c17
28 files changed, 398 insertions, 309 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dd1fd7f9ebf..c7b921b926e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,73 @@
2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
+ * gregset.h (struct regcache): Add forward declaration.
+ (supply_gregset): Add REGCACHE parameter, make GREGS const.
+ (supply_fpregset): Add REGCACHE parameter, make FPREGS const.
+ (supply_fpxregset): Add REGCACHE parameter, make FPXREGS const.
+ (fill_gregset): Add REGCACHE parameter.
+ (fill_fpregset): Likewise.
+ (fill_fpxregset): Likewise.
+
+ Update all definitions accordingly:
+ * alphabsd-nat.c, alpha-linux-nat.c, alpha-nat.c, amd64-linux-nat.c,
+ arm-linux-nat.c, hppa-linux-nat.c, i386gnu-nat.c, i386-linux-nat.c,
+ i386-sol2-nat.c, i386v4-nat.c, ia64-linux-nat.c, irix5-nat.c,
+ m32r-linux-nat.c, m68klinux-nat.c, mips-linux-nat.c, ppc-linux-nat.c,
+ s390-nat.c, sparc64-linux-nat.c, sparc-linux-nat.c, sparc-sol2-nat.c
+ (supply_gregset): Add REGCACHE parameter, use it instead of
+ current_regcache. Make GREGSETP parameter const, adapt casts.
+ (supply_fpregset): Add REGCACHE parameter, use it instead of
+ current_regcache. Make FPREGSETP parameter const, adapt casts.
+ (fill_gregset): Add REGCACHE parameter, use it instead of
+ current_regcache.
+ (fill_fpregset): Likewise.
+
+ Update all callers to pass in current_regcache as the new argument:
+ * core-regset.c: Include "regcache.h".
+ (fetch_core_registers): Update supply_gregset,and supply_fpregset calls.
+ * procfs.c: Include "regcache.h".
+ (procfs_fetch_registers): Update supply_gregset, supply_fpregset calls.
+ (procfs_store_registers): Update fill_gregset, fill_fpregset calls.
+ (procfs_do_thread_registers): Likewise.
+ (procfs_make_note_section): Likewise.
+ * proc-service.c: Include "regcache.h".
+ (ps_lgetregs): Update fill_gregset call.
+ (ps_lsetregs): Update supply_gregset call.
+ (ps_lgetfpregs): Update fill_fpregset call.
+ (ps_lsetfpregs): Update supply_fpregset call.
+ * sol-thread.c (sol_thread_fetch_registers): Update supply_gregset,
+ supply_fpregset calls.
+ (sol_thread_store_registers): Update fill_gregset, fill_fpregset calls.
+ (ps_lgetregs): Update fill_gregset call.
+ (ps_lsetregs): Update supply_gregset call.
+ (ps_lgetfpregs): Update fill_fpregset call.
+ (ps_lsetfpregs): Update supply_fpregset call.
+
+ * linux-nat.c (linux_nat_do_thread_registers): Update fill_gregset,
+ fill_fpregset, and fill_fpxregset calls.
+ * i386-linux-nat.c (fetch_regs): Update supply_gregset call.
+ (store_regs): Update fill_gregset call.
+ (fetch_fpregs): Update supply_fpregset call.
+ (store_fpregs): Update fill_fpregset call.
+ (fetch_fpxregs): Update supply_fpxregset call.
+ (store_fpxregs): Update fill_fpxregset call.
+ * m32r-linux-nat.c (fetch_regs): Update supply_gregset call.
+ (store_regs): Update fill_gregset call.
+ * m68klinux-nat.c (fetch_regs): Update supply_gregset call.
+ (store_regs): Update fill_gregset call.
+ (fetch_fpregs): Update supply_fpregset call.
+ (store_fpregs): Update fill_fpregset call.
+ (fetch_core_registers): Update supply_gregset, supply_fpregset calls.
+ * s390-nat.c (fetch_regs): Update supply_gregset call.
+ (store_regs): Update fill_gregset call.
+ (fetch_fpregs): Update supply_fpregset call.
+ (store_fpregs): Update fill_fpregset call.
+
+ * Makefile.in (core-regset.o, procfs.o, proc-service.o): Update
+ dependencies.
+
+2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
+
* monitor.c (monitor_supply_register): Add REGCACHE parameter, use
it instead of current_regcache.
(parse_register_dump): Add REGCACHE parameter, pass it to
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index a24eea4220e..98a42747b98 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1887,7 +1887,7 @@ corelow.o: corelow.c $(defs_h) $(arch_utils_h) $(gdb_string_h) $(frame_h) \
$(exec_h) $(readline_h) $(gdb_assert_h) \
$(exceptions_h) $(solib_h)
core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \
- $(inferior_h) $(target_h) $(gdb_string_h) $(gregset_h)
+ $(inferior_h) $(target_h) $(regcache_h) $(gdb_string_h) $(gregset_h)
cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
$(ui_out_h) $(gdb_string_h)
cp-name-parser.o: cp-name-parser.c $(safe_ctype_h) $(libiberty_h) $(demangle_h)
@@ -2462,11 +2462,11 @@ proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(gdb_wait_h) \
proc-events.o: proc-events.c $(defs_h)
proc-flags.o: proc-flags.c $(defs_h)
procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
- $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(gdb_wait_h) \
+ $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(regcache_h) $(gdb_wait_h) \
$(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \
$(gdb_dirent_h) $(gdb_stat_h) $(proc_utils_h) $(gregset_h)
proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \
- $(symtab_h) $(target_h) $(gregset_h)
+ $(symtab_h) $(target_h) $(regcache_h) $(gregset_h)
proc-why.o: proc-why.c $(defs_h) $(proc_utils_h)
prologue-value.o: prologue-value.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \
$(prologue_value_h) $(regcache_h)
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 3b020ba151f..016884a3275 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -40,21 +40,22 @@
*/
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
- long *regp = (long *)gregsetp;
+ const long *regp = (const long *)gregsetp;
/* PC is in slot 32, UNIQUE is in slot 33. */
- alpha_supply_int_regs (current_regcache, -1, regp, regp + 31, regp + 32);
+ alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
}
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
long *regp = (long *)gregsetp;
/* PC is in slot 32, UNIQUE is in slot 33. */
- alpha_fill_int_regs (current_regcache, regno, regp, regp + 31, regp + 32);
+ alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
}
/*
@@ -63,21 +64,22 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
*/
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
- long *regp = (long *)fpregsetp;
+ const long *regp = (const long *)fpregsetp;
/* FPCR is in slot 32. */
- alpha_supply_fp_regs (current_regcache, -1, regp, regp + 31);
+ alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
}
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
long *regp = (long *)fpregsetp;
/* FPCR is in slot 32. */
- alpha_fill_fp_regs (current_regcache, regno, regp, regp + 31);
+ alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
}
diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c
index 9a41dd182a7..bea5bcd1648 100644
--- a/gdb/alpha-nat.c
+++ b/gdb/alpha-nat.c
@@ -153,21 +153,22 @@ kernel_u_size (void)
*/
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
- long *regp = gregsetp->regs;
+ const long *regp = gregsetp->regs;
/* PC is in slot 32. */
- alpha_supply_int_regs (current_regcache, -1, regp, regp + 31, NULL);
+ alpha_supply_int_regs (regcache, -1, regp, regp + 31, NULL);
}
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
long *regp = gregsetp->regs;
/* PC is in slot 32. */
- alpha_fill_int_regs (current_regcache, regno, regp, regp + 31, NULL);
+ alpha_fill_int_regs (regcache, regno, regp, regp + 31, NULL);
}
/*
@@ -176,21 +177,22 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
*/
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
- long *regp = fpregsetp->regs;
+ const long *regp = fpregsetp->regs;
/* FPCR is in slot 32. */
- alpha_supply_fp_regs (current_regcache, -1, regp, regp + 31);
+ alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
}
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
long *regp = fpregsetp->regs;
/* FPCR is in slot 32. */
- alpha_fill_fp_regs (current_regcache, regno, regp, regp + 31);
+ alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
}
#endif
diff --git a/gdb/alphabsd-nat.c b/gdb/alphabsd-nat.c
index a8bf532e9f7..9eb1937cf91 100644
--- a/gdb/alphabsd-nat.c
+++ b/gdb/alphabsd-nat.c
@@ -50,27 +50,27 @@ typedef struct fpreg fpregset_t;
supply/fill routines. */
void
-supply_gregset (gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
{
- alphabsd_supply_reg (current_regcache, (char *) gregsetp, -1);
+ alphabsd_supply_reg (regcache, (const char *) gregsetp, -1);
}
void
-fill_gregset (gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
{
- alphabsd_fill_reg (current_regcache, (char *) gregsetp, regno);
+ alphabsd_fill_reg (regcache, (char *) gregsetp, regno);
}
void
-supply_fpregset (fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
- alphabsd_supply_fpreg (current_regcache, (char *) fpregsetp, -1);
+ alphabsd_supply_fpreg (regcache, (const char *) fpregsetp, -1);
}
void
-fill_fpregset (fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *fpregsetp, int regno)
{
- alphabsd_fill_fpreg (current_regcache, (char *) fpregsetp, regno);
+ alphabsd_fill_fpreg (regcache, (char *) fpregsetp, regno);
}
/* Determine if PT_GETREGS fetches this register. */
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 6f0e4a5fcbd..7a253a3c943 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -111,9 +111,9 @@ static int amd64_linux_gregset32_reg_offset[] =
in *GREGSETP. */
void
-supply_gregset (elf_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
- amd64_supply_native_gregset (current_regcache, gregsetp, -1);
+ amd64_supply_native_gregset (regcache, gregsetp, -1);
}
/* Fill register REGNUM (if it is a general-purpose register) in
@@ -121,9 +121,10 @@ supply_gregset (elf_gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (elf_gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache,
+ elf_gregset_t *gregsetp, int regnum)
{
- amd64_collect_native_gregset (current_regcache, gregsetp, regnum);
+ amd64_collect_native_gregset (regcache, gregsetp, regnum);
}
/* Transfering floating-point registers between GDB, inferiors and cores. */
@@ -132,9 +133,9 @@ fill_gregset (elf_gregset_t *gregsetp, int regnum)
values in *FPREGSETP. */
void
-supply_fpregset (elf_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
- amd64_supply_fxsave (current_regcache, -1, fpregsetp);
+ amd64_supply_fxsave (regcache, -1, fpregsetp);
}
/* Fill register REGNUM (if it is a floating-point or SSE register) in
@@ -142,9 +143,10 @@ supply_fpregset (elf_fpregset_t *fpregsetp)
-1, do this for all registers. */
void
-fill_fpregset (elf_fpregset_t *fpregsetp, int regnum)
+fill_fpregset (const struct regcache *regcache,
+ elf_fpregset_t *fpregsetp, int regnum)
{
- amd64_collect_fxsave (current_regcache, regnum, fpregsetp);
+ amd64_collect_fxsave (regcache, regnum, fpregsetp);
}
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index b50f8969a18..997120dbc43 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -503,30 +503,32 @@ arm_linux_store_inferior_registers (int regno)
thread debugging. */
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
- arm_linux_collect_gregset (NULL, current_regcache, regno, gregsetp, 0);
+ arm_linux_collect_gregset (NULL, regcache, regno, gregsetp, 0);
}
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
- arm_linux_supply_gregset (NULL, current_regcache, -1, gregsetp, 0);
+ arm_linux_supply_gregset (NULL, regcache, -1, gregsetp, 0);
}
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
- arm_linux_collect_nwfpe (NULL, current_regcache, regno, fpregsetp, 0);
+ arm_linux_collect_nwfpe (NULL, regcache, regno, fpregsetp, 0);
}
/* Fill GDB's register array with the floating-point register values
in *fpregsetp. */
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
- arm_linux_supply_nwfpe (NULL, current_regcache, -1, fpregsetp, 0);
+ arm_linux_supply_nwfpe (NULL, regcache, -1, fpregsetp, 0);
}
/* Fetch the thread-local storage pointer for libthread_db. */
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 3f104860722..a43922d6426 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -34,6 +34,7 @@
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
+#include "regcache.h"
#include <fcntl.h>
#include <errno.h>
@@ -73,7 +74,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (&gregset);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) &gregset);
}
break;
@@ -84,7 +85,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
if (FP0_REGNUM >= 0)
- supply_fpregset (&fpregset);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) &fpregset);
}
break;
diff --git a/gdb/gregset.h b/gdb/gregset.h
index ae17542aac2..38caacea594 100644
--- a/gdb/gregset.h
+++ b/gdb/gregset.h
@@ -32,6 +32,8 @@
typedef GDB_GREGSET_T gdb_gregset_t;
typedef GDB_FPREGSET_T gdb_fpregset_t;
+struct regcache;
+
/* A gregset is a data structure supplied by the native OS containing
the general register values of the debugged process. Usually this
includes integer registers and control registers. An fpregset is a
@@ -42,15 +44,19 @@ typedef GDB_FPREGSET_T gdb_fpregset_t;
/* Copy register values from the native target gregset/fpregset
into GDB's internal register cache. */
-extern void supply_gregset (gdb_gregset_t *gregs);
-extern void supply_fpregset (gdb_fpregset_t *fpregs);
+extern void supply_gregset (struct regcache *regcache,
+ const gdb_gregset_t *gregs);
+extern void supply_fpregset (struct regcache *regcache,
+ const gdb_fpregset_t *fpregs);
/* Copy register values from GDB's register cache into
the native target gregset/fpregset. If regno is -1,
copy all the registers. */
-extern void fill_gregset (gdb_gregset_t *gregs, int regno);
-extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno);
+extern void fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregs, int regno);
+extern void fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregs, int regno);
#ifdef FILL_FPXREGSET
/* GNU/Linux i386: Copy register values between GDB's internal register cache
@@ -62,8 +68,10 @@ extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno);
typedef GDB_FPXREGSET_T gdb_fpxregset_t;
-extern void supply_fpxregset (gdb_fpxregset_t *fpxregs);
-extern void fill_fpxregset (gdb_fpxregset_t *fpxregs, int regno);
+extern void supply_fpxregset (struct regcache *regcache,
+ const gdb_fpxregset_t *fpxregs);
+extern void fill_fpxregset (const struct regcache *regcache,
+ gdb_fpxregset_t *fpxregs, int regno);
#endif
#endif
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index ec6f5456437..274f14007bb 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -305,15 +305,15 @@ hppa_linux_store_inferior_registers (int regno)
in *gregsetp. */
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
int i;
- greg_t *regp = (elf_greg_t *) gregsetp;
+ const greg_t *regp = (const elf_greg_t *) gregsetp;
for (i = 0; i < sizeof (greg_map) / sizeof (greg_map[0]); i++, regp++)
{
int regno = greg_map[i];
- regcache_raw_supply (current_regcache, regno, regp);
+ regcache_raw_supply (regcache, regno, regp);
}
}
@@ -322,7 +322,8 @@ supply_gregset (gdb_gregset_t *gregsetp)
If regno is -1, do this for all registers. */
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
int i;
@@ -332,7 +333,7 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
if (regno == -1 || regno == mregno)
{
- regcache_raw_collect(current_regcache, mregno, &(*gregsetp)[i]);
+ regcache_raw_collect(regcache, mregno, &(*gregsetp)[i]);
}
}
}
@@ -342,17 +343,16 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
idea of the current floating point register values. */
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
int regi;
- char *from;
+ const char *from;
for (regi = 0; regi <= 31; regi++)
{
- from = (char *) &((*fpregsetp)[regi]);
- regcache_raw_supply (current_regcache, 2*regi + HPPA_FP0_REGNUM, from);
- regcache_raw_supply (current_regcache, 2*regi + HPPA_FP0_REGNUM + 1,
- from + 4);
+ from = (const char *) &((*fpregsetp)[regi]);
+ regcache_raw_supply (regcache, 2*regi + HPPA_FP0_REGNUM, from);
+ regcache_raw_supply (regcache, 2*regi + HPPA_FP0_REGNUM + 1, from + 4);
}
}
@@ -362,7 +362,8 @@ supply_fpregset (gdb_fpregset_t *fpregsetp)
them all. */
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
int i;
@@ -373,7 +374,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
char *to = (char *) &((*fpregsetp)[(i - HPPA_FP0_REGNUM) / 2]);
if ((i - HPPA_FP0_REGNUM) & 1)
to += 4;
- regcache_raw_collect (current_regcache, i, to);
+ regcache_raw_collect (regcache, i, to);
}
}
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 8572c579a97..bfa099dd011 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -201,16 +201,16 @@ store_register (int regno)
in *GREGSETP. */
void
-supply_gregset (elf_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
- elf_greg_t *regp = (elf_greg_t *) gregsetp;
+ const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
int i;
for (i = 0; i < I386_NUM_GREGS; i++)
- regcache_raw_supply (current_regcache, i, regp + regmap[i]);
+ regcache_raw_supply (regcache, i, regp + regmap[i]);
if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
- regcache_raw_supply (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+ regcache_raw_supply (regcache, I386_LINUX_ORIG_EAX_REGNUM,
regp + ORIG_EAX);
}
@@ -219,18 +219,19 @@ supply_gregset (elf_gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (elf_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ elf_gregset_t *gregsetp, int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
for (i = 0; i < I386_NUM_GREGS; i++)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i, regp + regmap[i]);
+ regcache_raw_collect (regcache, i, regp + regmap[i]);
if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
&& I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
- regcache_raw_collect (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+ regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM,
regp + ORIG_EAX);
}
@@ -257,7 +258,7 @@ fetch_regs (int tid)
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (&regs);
+ supply_gregset (current_regcache, (const elf_gregset_t *) &regs);
}
/* Store all valid general-purpose registers in GDB's register array
@@ -271,7 +272,7 @@ store_regs (int tid, int regno)
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (&regs, regno);
+ fill_gregset (current_regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't write registers"));
@@ -291,9 +292,9 @@ static void store_regs (int tid, int regno) {}
*FPREGSETP. */
void
-supply_fpregset (elf_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
- i387_supply_fsave (current_regcache, -1, fpregsetp);
+ i387_supply_fsave (regcache, -1, fpregsetp);
}
/* Fill register REGNO (if it is a floating-point register) in
@@ -301,9 +302,10 @@ supply_fpregset (elf_fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ elf_fpregset_t *fpregsetp, int regno)
{
- i387_collect_fsave (current_regcache, regno, fpregsetp);
+ i387_collect_fsave (regcache, regno, fpregsetp);
}
#ifdef HAVE_PTRACE_GETREGS
@@ -319,7 +321,7 @@ fetch_fpregs (int tid)
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (&fpregs);
+ supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register array
@@ -333,7 +335,7 @@ store_fpregs (int tid, int regno)
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (&fpregs, regno);
+ fill_fpregset (current_regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
@@ -355,9 +357,10 @@ static void store_fpregs (int tid, int regno) {}
values in *FPXREGSETP. */
void
-supply_fpxregset (elf_fpxregset_t *fpxregsetp)
+supply_fpxregset (struct regcache *regcache,
+ const elf_fpxregset_t *fpxregsetp)
{
- i387_supply_fxsave (current_regcache, -1, fpxregsetp);
+ i387_supply_fxsave (regcache, -1, fpxregsetp);
}
/* Fill register REGNO (if it is a floating-point or SSE register) in
@@ -365,9 +368,10 @@ supply_fpxregset (elf_fpxregset_t *fpxregsetp)
-1, do this for all registers. */
void
-fill_fpxregset (elf_fpxregset_t *fpxregsetp, int regno)
+fill_fpxregset (const struct regcache *regcache,
+ elf_fpxregset_t *fpxregsetp, int regno)
{
- i387_collect_fxsave (current_regcache, regno, fpxregsetp);
+ i387_collect_fxsave (regcache, regno, fpxregsetp);
}
/* Fetch all registers covered by the PTRACE_GETFPXREGS request from
@@ -393,7 +397,7 @@ fetch_fpxregs (int tid)
perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
- supply_fpxregset (&fpxregs);
+ supply_fpxregset (current_regcache, (const elf_fpxregset_t *) &fpxregs);
return 1;
}
@@ -420,7 +424,7 @@ store_fpxregs (int tid, int regno)
perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
- fill_fpxregset (&fpxregs, regno);
+ fill_fpxregset (current_regcache, &fpxregs, regno);
if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
perror_with_name (_("Couldn't write floating-point and SSE registers"));
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 97362e0e07a..d47ca618123 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -99,27 +99,29 @@ static int amd64_sol2_gregset32_reg_offset[] = {
};
void
-supply_gregset (prgregset_t *gregs)
+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
{
- amd64_supply_native_gregset (current_regcache, gregs, -1);
+ amd64_supply_native_gregset (regcache, gregs, -1);
}
void
-supply_fpregset (prfpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- amd64_supply_fxsave (current_regcache, -1, fpregs);
+ amd64_supply_fxsave (regcache, -1, fpregs);
}
void
-fill_gregset (prgregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache,
+ prgregset_t *gregs, int regnum)
{
- amd64_collect_native_gregset (current_regcache, gregs, regnum);
+ amd64_collect_native_gregset (regcache, gregs, regnum);
}
void
-fill_fpregset (prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache,
+ prfpregset_t *fpregs, int regnum)
{
- amd64_collect_fxsave (current_regcache, regnum, fpregs);
+ amd64_collect_fxsave (regcache, regnum, fpregs);
}
#else
diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
index 3c2c574f091..3b6199711f2 100644
--- a/gdb/i386gnu-nat.c
+++ b/gdb/i386gnu-nat.c
@@ -59,6 +59,7 @@ static int reg_offset[] =
};
#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
+#define CREG_ADDR(state, regnum) ((const char *)(state) + reg_offset[regnum])
/* Get the whole floating-point state of THREAD and record the values
@@ -96,17 +97,17 @@ fetch_fpregs (struct proc *thread)
/* These two calls are used by the core-regset.c code for
reading ELF core files. */
void
-supply_gregset (gdb_gregset_t *gregs)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregs)
{
int i;
for (i = 0; i < I386_NUM_GREGS; i++)
- regcache_raw_supply (current_regcache, i, REG_ADDR (gregs, i));
+ regcache_raw_supply (regcache, i, CREG_ADDR (gregs, i));
}
void
-supply_fpregset (gdb_fpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
{
- i387_supply_fsave (current_regcache, -1, fpregs);
+ i387_supply_fsave (regcache, -1, fpregs);
}
#endif
diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c
index 6829fa6d2fa..695207b3847 100644
--- a/gdb/i386v4-nat.c
+++ b/gdb/i386v4-nat.c
@@ -104,13 +104,13 @@ static int regmap[] =
in *GREGSETP. */
void
-supply_gregset (gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
{
- greg_t *regp = (greg_t *) gregsetp;
+ const greg_t *regp = (const greg_t *) gregsetp;
int regnum;
for (regnum = 0; regnum < I386_NUM_GREGS; regnum++)
- regcache_raw_supply (current_regcache, regnum, regp + regmap[regnum]);
+ regcache_raw_supply (regcache, regnum, regp + regmap[regnum]);
}
/* Fill register REGNUM (if it is a general-purpose register) in
@@ -118,14 +118,15 @@ supply_gregset (gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache,
+ gregset_t *gregsetp, int regnum)
{
greg_t *regp = (greg_t *) gregsetp;
int i;
for (i = 0; i < I386_NUM_GREGS; i++)
if (regnum == -1 || regnum == i)
- regcache_raw_collect (current_regcache, i, regp + regmap[i]);
+ regcache_raw_collect (regcache, i, regp + regmap[i]);
}
#endif /* HAVE_GREGSET_T */
@@ -136,12 +137,12 @@ fill_gregset (gregset_t *gregsetp, int regnum)
*FPREGSETP. */
void
-supply_fpregset (fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
if (FP0_REGNUM == 0)
return;
- i387_supply_fsave (current_regcache, -1, fpregsetp);
+ i387_supply_fsave (regcache, -1, fpregsetp);
}
/* Fill register REGNO (if it is a floating-point register) in
@@ -149,12 +150,13 @@ supply_fpregset (fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ fpregset_t *fpregsetp, int regno)
{
if (FP0_REGNUM == 0)
return;
- i387_collect_fsave (current_regcache, regno, fpregsetp);
+ i387_collect_fsave (regcache, regno, fpregsetp);
}
#endif /* HAVE_FPREGSET_T */
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 989550a8120..8207be41cde 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -362,65 +362,51 @@ ia64_cannot_store_register (int regno)
}
void
-supply_gregset (gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
{
int regi;
- greg_t *regp = (greg_t *) gregsetp;
+ const greg_t *regp = (const greg_t *) gregsetp;
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
{
- regcache_raw_supply (current_regcache, regi,
- (char *) (regp + (regi - IA64_GR0_REGNUM)));
+ regcache_raw_supply (regcache, regi, regp + (regi - IA64_GR0_REGNUM));
}
/* FIXME: NAT collection bits are at index 32; gotta deal with these
somehow... */
- regcache_raw_supply (current_regcache, IA64_PR_REGNUM, (char *) (regp + 33));
+ regcache_raw_supply (regcache, IA64_PR_REGNUM, regp + 33);
for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
{
- regcache_raw_supply (current_regcache, regi,
- (char *) (regp + 34 + (regi - IA64_BR0_REGNUM)));
+ regcache_raw_supply (regcache, regi,
+ regp + 34 + (regi - IA64_BR0_REGNUM));
}
- regcache_raw_supply (current_regcache, IA64_IP_REGNUM,
- (char *) (regp + 42));
- regcache_raw_supply (current_regcache, IA64_CFM_REGNUM,
- (char *) (regp + 43));
- regcache_raw_supply (current_regcache, IA64_PSR_REGNUM,
- (char *) (regp + 44));
- regcache_raw_supply (current_regcache, IA64_RSC_REGNUM,
- (char *) (regp + 45));
- regcache_raw_supply (current_regcache, IA64_BSP_REGNUM,
- (char *) (regp + 46));
- regcache_raw_supply (current_regcache, IA64_BSPSTORE_REGNUM,
- (char *) (regp + 47));
- regcache_raw_supply (current_regcache, IA64_RNAT_REGNUM,
- (char *) (regp + 48));
- regcache_raw_supply (current_regcache, IA64_CCV_REGNUM,
- (char *) (regp + 49));
- regcache_raw_supply (current_regcache, IA64_UNAT_REGNUM,
- (char *) (regp + 50));
- regcache_raw_supply (current_regcache, IA64_FPSR_REGNUM,
- (char *) (regp + 51));
- regcache_raw_supply (current_regcache, IA64_PFS_REGNUM,
- (char *) (regp + 52));
- regcache_raw_supply (current_regcache, IA64_LC_REGNUM,
- (char *) (regp + 53));
- regcache_raw_supply (current_regcache, IA64_EC_REGNUM,
- (char *) (regp + 54));
+ regcache_raw_supply (regcache, IA64_IP_REGNUM, regp + 42);
+ regcache_raw_supply (regcache, IA64_CFM_REGNUM, regp + 43);
+ regcache_raw_supply (regcache, IA64_PSR_REGNUM, regp + 44);
+ regcache_raw_supply (regcache, IA64_RSC_REGNUM, regp + 45);
+ regcache_raw_supply (regcache, IA64_BSP_REGNUM, regp + 46);
+ regcache_raw_supply (regcache, IA64_BSPSTORE_REGNUM, regp + 47);
+ regcache_raw_supply (regcache, IA64_RNAT_REGNUM, regp + 48);
+ regcache_raw_supply (regcache, IA64_CCV_REGNUM, regp + 49);
+ regcache_raw_supply (regcache, IA64_UNAT_REGNUM, regp + 50);
+ regcache_raw_supply (regcache, IA64_FPSR_REGNUM, regp + 51);
+ regcache_raw_supply (regcache, IA64_PFS_REGNUM, regp + 52);
+ regcache_raw_supply (regcache, IA64_LC_REGNUM, regp + 53);
+ regcache_raw_supply (regcache, IA64_EC_REGNUM, regp + 54);
}
void
-fill_gregset (gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
{
int regi;
greg_t *regp = (greg_t *) gregsetp;
#define COPY_REG(_idx_,_regi_) \
if ((regno == -1) || regno == _regi_) \
- regcache_raw_collect (current_regcache, _regi_, regp + _idx_)
+ regcache_raw_collect (regcache, _regi_, regp + _idx_)
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
{
@@ -456,15 +442,15 @@ fill_gregset (gregset_t *gregsetp, int regno)
idea of the current floating point register values. */
void
-supply_fpregset (fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
int regi;
- char *from;
+ const char *from;
for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
{
- from = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
- regcache_raw_supply (current_regcache, regi, from);
+ from = (const char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
+ regcache_raw_supply (regcache, regi, from);
}
}
@@ -474,14 +460,15 @@ supply_fpregset (fpregset_t *fpregsetp)
them all. */
void
-fill_fpregset (fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ fpregset_t *fpregsetp, int regno)
{
int regi;
for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
- regcache_raw_collect (current_regcache, regi,
+ regcache_raw_collect (regcache, regi,
&((*fpregsetp)[regi - IA64_FR0_REGNUM]));
}
}
diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c
index 184d8cecaf4..907764c085d 100644
--- a/gdb/irix5-nat.c
+++ b/gdb/irix5-nat.c
@@ -54,32 +54,32 @@ static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
*/
void
-supply_gregset (gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
{
int regi;
- greg_t *regp = &(*gregsetp)[0];
+ const greg_t *regp = &(*gregsetp)[0];
int gregoff = sizeof (greg_t) - mips_isa_regsize (current_gdbarch);
static char zerobuf[32] = {0};
for (regi = 0; regi <= CTX_RA; regi++)
- regcache_raw_supply (current_regcache, regi,
- (char *) (regp + regi) + gregoff);
-
- regcache_raw_supply (current_regcache, mips_regnum (current_gdbarch)->pc,
- (char *) (regp + CTX_EPC) + gregoff);
- regcache_raw_supply (current_regcache, mips_regnum (current_gdbarch)->hi,
- (char *) (regp + CTX_MDHI) + gregoff);
- regcache_raw_supply (current_regcache, mips_regnum (current_gdbarch)->lo,
- (char *) (regp + CTX_MDLO) + gregoff);
- regcache_raw_supply (current_regcache, mips_regnum (current_gdbarch)->cause,
- (char *) (regp + CTX_CAUSE) + gregoff);
+ regcache_raw_supply (regcache, regi,
+ (const char *) (regp + regi) + gregoff);
+
+ regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->pc,
+ (const char *) (regp + CTX_EPC) + gregoff);
+ regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->hi,
+ (const char *) (regp + CTX_MDHI) + gregoff);
+ regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->lo,
+ (const char *) (regp + CTX_MDLO) + gregoff);
+ regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->cause,
+ (const char *) (regp + CTX_CAUSE) + gregoff);
/* Fill inaccessible registers with zero. */
- regcache_raw_supply (current_regcache, mips_regnum (current_gdbarch)->badvaddr, zerobuf);
+ regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->badvaddr, zerobuf);
}
void
-fill_gregset (gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
{
int regi, size;
greg_t *regp = &(*gregsetp)[0];
@@ -93,7 +93,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
if ((regno == -1) || (regno == regi))
{
size = register_size (current_gdbarch, regi);
- regcache_raw_collect (current_regcache, regi, buf);
+ regcache_raw_collect (regcache, regi, buf);
*(regp + regi) = extract_signed_integer (buf, size);
}
@@ -101,7 +101,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
{
regi = mips_regnum (current_gdbarch)->pc;
size = register_size (current_gdbarch, regi);
- regcache_raw_collect (current_regcache, regi, buf);
+ regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_EPC) = extract_signed_integer (buf, size);
}
@@ -109,7 +109,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
{
regi = mips_regnum (current_gdbarch)->cause;
size = register_size (current_gdbarch, regi);
- regcache_raw_collect (current_regcache, regi, buf);
+ regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_CAUSE) = extract_signed_integer (buf, size);
}
@@ -117,7 +117,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
{
regi = mips_regnum (current_gdbarch)->hi;
size = register_size (current_gdbarch, regi);
- regcache_raw_collect (current_regcache, regi, buf);
+ regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_MDHI) = extract_signed_integer (buf, size);
}
@@ -125,7 +125,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
{
regi = mips_regnum (current_gdbarch)->lo;
size = register_size (current_gdbarch, regi);
- regcache_raw_collect (current_regcache, regi, buf);
+ regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_MDLO) = extract_signed_integer (buf, size);
}
}
@@ -139,7 +139,7 @@ fill_gregset (gregset_t *gregsetp, int regno)
*/
void
-supply_fpregset (fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
int regi;
static char zerobuf[32] = {0};
@@ -148,8 +148,8 @@ supply_fpregset (fpregset_t *fpregsetp)
/* FIXME, this is wrong for the N32 ABI which has 64 bit FP regs. */
for (regi = 0; regi < 32; regi++)
- regcache_raw_supply (current_regcache, FP0_REGNUM + regi,
- (char *) &fpregsetp->fp_r.fp_regs[regi]);
+ regcache_raw_supply (regcache, FP0_REGNUM + regi,
+ (const char *) &fpregsetp->fp_r.fp_regs[regi]);
/* We can't supply the FSR register directly to the regcache,
because there is a size issue: On one hand, fpregsetp->fp_csr
@@ -159,18 +159,18 @@ supply_fpregset (fpregset_t *fpregsetp)
memset (fsrbuf, 0, 4);
memcpy (fsrbuf + 4, &fpregsetp->fp_csr, 4);
- regcache_raw_supply (current_regcache,
+ regcache_raw_supply (regcache,
mips_regnum (current_gdbarch)->fp_control_status,
fsrbuf);
/* FIXME: how can we supply FCRIR? SGI doesn't tell us. */
- regcache_raw_supply (current_regcache,
+ regcache_raw_supply (regcache,
mips_regnum (current_gdbarch)->fp_implementation_revision,
zerobuf);
}
void
-fill_fpregset (fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *fpregsetp, int regno)
{
int regi;
char *from, *to;
@@ -182,7 +182,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
if ((regno == -1) || (regno == regi))
{
to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]);
- regcache_raw_collect (current_regcache, regi, to);
+ regcache_raw_collect (regcache, regi, to);
}
}
@@ -196,7 +196,7 @@ fill_fpregset (fpregset_t *fpregsetp, int regno)
is 32bits long, while the regcache expects a 64bits long buffer.
So we use a buffer of the correct size and copy the register
value from that buffer. */
- regcache_raw_collect (current_regcache,
+ regcache_raw_collect (regcache,
mips_regnum (current_gdbarch)->fp_control_status,
fsrbuf);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 8430eb73078..46655815d27 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2591,7 +2591,7 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
regset->collect_regset (regset, current_regcache, -1,
&gregs, sizeof (gregs));
else
- fill_gregset (&gregs, -1);
+ fill_gregset (current_regcache, &gregs, -1);
note_data = (char *) elfcore_write_prstatus (obfd,
note_data,
@@ -2606,7 +2606,7 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
regset->collect_regset (regset, current_regcache, -1,
&fpregs, sizeof (fpregs));
else
- fill_fpregset (&fpregs, -1);
+ fill_fpregset (current_regcache, &fpregs, -1);
note_data = (char *) elfcore_write_prfpreg (obfd,
note_data,
@@ -2621,7 +2621,7 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
regset->collect_regset (regset, current_regcache, -1,
&fpxregs, sizeof (fpxregs));
else
- fill_fpxregset (&fpxregs, -1);
+ fill_fpxregset (current_regcache, &fpxregs, -1);
note_data = (char *) elfcore_write_prxfpreg (obfd,
note_data,
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
index 2b17aadf2fe..32d3de91403 100644
--- a/gdb/m32r-linux-nat.c
+++ b/gdb/m32r-linux-nat.c
@@ -69,9 +69,9 @@ static int regmap[] = {
in *GREGSETP. */
void
-supply_gregset (elf_gregset_t * gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t * gregsetp)
{
- elf_greg_t *regp = (elf_greg_t *) gregsetp;
+ const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
int i;
unsigned long psw, bbpsw;
@@ -96,11 +96,11 @@ supply_gregset (elf_gregset_t * gregsetp)
}
if (i != M32R_SP_REGNUM)
- regcache_raw_supply (current_regcache, i, &regval);
+ regcache_raw_supply (regcache, i, &regval);
else if (psw & 0x8000)
- regcache_raw_supply (current_regcache, i, regp + SPU_REGMAP);
+ regcache_raw_supply (regcache, i, regp + SPU_REGMAP);
else
- regcache_raw_supply (current_regcache, i, regp + SPI_REGMAP);
+ regcache_raw_supply (regcache, i, regp + SPI_REGMAP);
}
}
@@ -115,7 +115,7 @@ fetch_regs (int tid)
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (&regs);
+ supply_gregset (current_regcache, (const elf_gregset_t *) &regs);
}
/* Fill register REGNO (if it is a general-purpose register) in
@@ -123,7 +123,8 @@ fetch_regs (int tid)
do this for all registers. */
void
-fill_gregset (elf_gregset_t * gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ elf_gregset_t * gregsetp, int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
@@ -144,11 +145,11 @@ fill_gregset (elf_gregset_t * gregsetp, int regno)
continue;
if (i != M32R_SP_REGNUM)
- regcache_raw_collect (current_regcache, i, regp + regmap[i]);
+ regcache_raw_collect (regcache, i, regp + regmap[i]);
else if (psw & 0x8000)
- regcache_raw_collect (current_regcache, i, regp + SPU_REGMAP);
+ regcache_raw_collect (regcache, i, regp + SPU_REGMAP);
else
- regcache_raw_collect (current_regcache, i, regp + SPI_REGMAP);
+ regcache_raw_collect (regcache, i, regp + SPI_REGMAP);
}
}
@@ -163,7 +164,7 @@ store_regs (int tid, int regno)
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (&regs, regno);
+ fill_gregset (current_regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't write registers"));
@@ -175,12 +176,13 @@ store_regs (int tid, int regno)
Since M32R has no floating-point registers, these functions do nothing. */
void
-supply_fpregset (gdb_fpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
{
}
void
-fill_fpregset (gdb_fpregset_t *fpregs, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregs, int regno)
{
}
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index f8a24bb6e4e..e2d2af29ce3 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -242,29 +242,30 @@ old_store_inferior_registers (int regno)
them as gdb's idea of the current register values. */
void
-supply_gregset (elf_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
- elf_greg_t *regp = (elf_greg_t *) gregsetp;
+ const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
int regi;
for (regi = M68K_D0_REGNUM; regi <= SP_REGNUM; regi++)
- regcache_raw_supply (current_regcache, regi, (char *) &regp[regmap[regi]]);
- regcache_raw_supply (current_regcache, PS_REGNUM, (char *) &regp[PT_SR]);
- regcache_raw_supply (current_regcache, PC_REGNUM, (char *) &regp[PT_PC]);
+ regcache_raw_supply (regcache, regi, &regp[regmap[regi]]);
+ regcache_raw_supply (regcache, PS_REGNUM, &regp[PT_SR]);
+ regcache_raw_supply (regcache, PC_REGNUM, &regp[PT_PC]);
}
/* Fill register REGNO (if it is a general-purpose register) in
*GREGSETPS with the value in GDB's register array. If REGNO is -1,
do this for all registers. */
void
-fill_gregset (elf_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ elf_gregset_t *gregsetp, int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
for (i = 0; i < NUM_GREGS; i++)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i, regp + regmap[i]);
+ regcache_raw_collect (regcache, i, regp + regmap[i]);
}
#ifdef HAVE_PTRACE_GETREGS
@@ -290,7 +291,7 @@ fetch_regs (int tid)
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (&regs);
+ supply_gregset (current_regcache, (const elf_gregset_t *) &regs);
}
/* Store all valid general-purpose registers in GDB's register array
@@ -304,7 +305,7 @@ store_regs (int tid, int regno)
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (&regs, regno);
+ fill_gregset (current_regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
perror_with_name (_("Couldn't write registers"));
@@ -321,25 +322,22 @@ static void store_regs (int tid, int regno) {}
/* Transfering floating-point registers between GDB, inferiors and cores. */
/* What is the address of fpN within the floating-point register set F? */
-#define FPREG_ADDR(f, n) ((char *) &(f)->fpregs[(n) * 3])
+#define FPREG_ADDR(f, n) (&(f)->fpregs[(n) * 3])
/* Fill GDB's register array with the floating-point register values in
*FPREGSETP. */
void
-supply_fpregset (elf_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
int regi;
for (regi = FP0_REGNUM; regi < FP0_REGNUM + 8; regi++)
- regcache_raw_supply (current_regcache, regi,
+ regcache_raw_supply (regcache, regi,
FPREG_ADDR (fpregsetp, regi - FP0_REGNUM));
- regcache_raw_supply (current_regcache, M68K_FPC_REGNUM,
- (char *) &fpregsetp->fpcntl[0]);
- regcache_raw_supply (current_regcache, M68K_FPS_REGNUM,
- (char *) &fpregsetp->fpcntl[1]);
- regcache_raw_supply (current_regcache, M68K_FPI_REGNUM,
- (char *) &fpregsetp->fpcntl[2]);
+ regcache_raw_supply (regcache, M68K_FPC_REGNUM, &fpregsetp->fpcntl[0]);
+ regcache_raw_supply (regcache, M68K_FPS_REGNUM, &fpregsetp->fpcntl[1]);
+ regcache_raw_supply (regcache, M68K_FPI_REGNUM, &fpregsetp->fpcntl[2]);
}
/* Fill register REGNO (if it is a floating-point register) in
@@ -347,21 +345,22 @@ supply_fpregset (elf_fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ elf_fpregset_t *fpregsetp, int regno)
{
int i;
/* Fill in the floating-point registers. */
for (i = FP0_REGNUM; i < FP0_REGNUM + 8; i++)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i,
+ regcache_raw_collect (regcache, i,
FPREG_ADDR (fpregsetp, i - FP0_REGNUM));
/* Fill in the floating-point control registers. */
for (i = M68K_FPC_REGNUM; i <= M68K_FPI_REGNUM; i++)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i,
- (char *) &fpregsetp->fpcntl[i - M68K_FPC_REGNUM]);
+ regcache_raw_collect (regcache, i,
+ &fpregsetp->fpcntl[i - M68K_FPC_REGNUM]);
}
#ifdef HAVE_PTRACE_GETREGS
@@ -377,7 +376,7 @@ fetch_fpregs (int tid)
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (&fpregs);
+ supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register array
@@ -391,7 +390,7 @@ store_fpregs (int tid, int regno)
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (&fpregs, regno);
+ fill_fpregset (current_regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
@@ -543,7 +542,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (&gregset);
+ supply_gregset (current_regcache, (const elf_gregset_t *) &gregset);
}
break;
@@ -553,7 +552,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
else
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
- supply_fpregset (&fpregset);
+ supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregset);
}
break;
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 62657240afc..f6eaa0b9b3f 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -177,39 +177,41 @@ ps_get_thread_area (const struct ps_prochandle *ph,
/* Wrapper functions. These are only used by libthread_db. */
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
if (mips_isa_regsize (current_gdbarch) == 4)
- mips_supply_gregset (current_regcache, (void *) gregsetp);
+ mips_supply_gregset (regcache, (const mips_elf_gregset_t *) gregsetp);
else
- mips64_supply_gregset (current_regcache, (void *) gregsetp);
+ mips64_supply_gregset (regcache, (const mips64_elf_gregset_t *) gregsetp);
}
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
if (mips_isa_regsize (current_gdbarch) == 4)
- mips_fill_gregset (current_regcache, (void *) gregsetp, regno);
+ mips_fill_gregset (regcache, (mips_elf_gregset_t *) gregsetp, regno);
else
- mips64_fill_gregset (current_regcache, (void *) gregsetp, regno);
+ mips64_fill_gregset (regcache, (mips64_elf_gregset_t *) gregsetp, regno);
}
void
-supply_fpregset (gdb_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
if (mips_isa_regsize (current_gdbarch) == 4)
- mips_supply_fpregset (current_regcache, (void *) fpregsetp);
+ mips_supply_fpregset (regcache, (const mips_elf_fpregset_t *) fpregsetp);
else
- mips64_supply_fpregset (current_regcache, (void *) fpregsetp);
+ mips64_supply_fpregset (regcache, (const mips64_elf_fpregset_t *) fpregsetp);
}
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
if (mips_isa_regsize (current_gdbarch) == 4)
- mips_fill_fpregset (current_regcache, (void *) fpregsetp, regno);
+ mips_fill_fpregset (regcache, (mips_elf_fpregset_t *) fpregsetp, regno);
else
- mips64_fill_fpregset (current_regcache, (void *) fpregsetp, regno);
+ mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *) fpregsetp, regno);
}
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 7cd43a9dff3..02e50f1d6f8 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -904,30 +904,31 @@ ppc_linux_store_inferior_registers (int regno)
}
void
-supply_gregset (gdb_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
/* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
interface, and not the wordsize of the program's ABI. */
int wordsize = sizeof (long);
- ppc_linux_supply_gregset (current_regcache, -1, gregsetp,
+ ppc_linux_supply_gregset (regcache, -1, gregsetp,
sizeof (gdb_gregset_t), wordsize);
}
static void
-right_fill_reg (int regnum, void *reg)
+right_fill_reg (const struct regcache *regcache, int regnum, void *reg)
{
/* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
interface, and not the wordsize of the program's ABI. */
int wordsize = sizeof (long);
/* Right fill the register. */
- regcache_raw_collect (current_regcache, regnum,
+ regcache_raw_collect (regcache, regnum,
((bfd_byte *) reg
+ wordsize
- register_size (current_gdbarch, regnum)));
}
void
-fill_gregset (gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache,
+ gdb_gregset_t *gregsetp, int regno)
{
int regi;
elf_greg_t *regp = (elf_greg_t *) gregsetp;
@@ -941,34 +942,35 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
for (regi = 0; regi < ppc_num_gprs; regi++)
{
if ((regno == -1) || regno == tdep->ppc_gp0_regnum + regi)
- right_fill_reg (tdep->ppc_gp0_regnum + regi, (regp + PT_R0 + regi));
+ right_fill_reg (regcache, tdep->ppc_gp0_regnum + regi,
+ (regp + PT_R0 + regi));
}
if ((regno == -1) || regno == PC_REGNUM)
- right_fill_reg (PC_REGNUM, regp + PT_NIP);
+ right_fill_reg (regcache, PC_REGNUM, regp + PT_NIP);
if ((regno == -1) || regno == tdep->ppc_lr_regnum)
- right_fill_reg (tdep->ppc_lr_regnum, regp + PT_LNK);
+ right_fill_reg (regcache, tdep->ppc_lr_regnum, regp + PT_LNK);
if ((regno == -1) || regno == tdep->ppc_cr_regnum)
- regcache_raw_collect (current_regcache, tdep->ppc_cr_regnum,
+ regcache_raw_collect (regcache, tdep->ppc_cr_regnum,
regp + PT_CCR);
if ((regno == -1) || regno == tdep->ppc_xer_regnum)
- regcache_raw_collect (current_regcache, tdep->ppc_xer_regnum,
+ regcache_raw_collect (regcache, tdep->ppc_xer_regnum,
regp + PT_XER);
if ((regno == -1) || regno == tdep->ppc_ctr_regnum)
right_fill_reg (tdep->ppc_ctr_regnum, regp + PT_CTR);
#ifdef PT_MQ
if (((regno == -1) || regno == tdep->ppc_mq_regnum)
&& (tdep->ppc_mq_regnum != -1))
- right_fill_reg (tdep->ppc_mq_regnum, regp + PT_MQ);
+ right_fill_reg (regcache, tdep->ppc_mq_regnum, regp + PT_MQ);
#endif
if ((regno == -1) || regno == tdep->ppc_ps_regnum)
- right_fill_reg (tdep->ppc_ps_regnum, regp + PT_MSR);
+ right_fill_reg (regcache, tdep->ppc_ps_regnum, regp + PT_MSR);
}
void
-supply_fpregset (gdb_fpregset_t * fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
{
- ppc_linux_supply_fpregset (NULL, current_regcache, -1, fpregsetp,
+ ppc_linux_supply_fpregset (NULL, regcache, -1, fpregsetp,
sizeof (gdb_fpregset_t));
}
@@ -977,7 +979,8 @@ supply_fpregset (gdb_fpregset_t * fpregsetp)
idea of the current floating point register set. If REGNO is -1,
update them all. */
void
-fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache,
+ gdb_fpregset_t *fpregsetp, int regno)
{
int regi;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@@ -988,7 +991,7 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
for (regi = 0; regi < ppc_num_fprs; regi++)
{
if ((regno == -1) || (regno == tdep->ppc_fp0_regnum + regi))
- regcache_raw_collect (current_regcache, tdep->ppc_fp0_regnum + regi,
+ regcache_raw_collect (regcache, tdep->ppc_fp0_regnum + regi,
fpp + 8 * regi);
}
if (regno == -1 || regno == tdep->ppc_fpscr_regnum)
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index befcb3b54ae..a8411f41186 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -27,6 +27,7 @@
#include "inferior.h"
#include "symtab.h"
#include "target.h"
+#include "regcache.h"
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
@@ -234,7 +235,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
target_fetch_registers (-1);
- fill_gregset ((gdb_gregset_t *) gregset, -1);
+ fill_gregset (current_regcache, (gdb_gregset_t *) gregset, -1);
do_cleanups (old_chain);
return PS_OK;
@@ -250,8 +251,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
- /* FIXME: We should really make supply_gregset const-correct. */
- supply_gregset ((gdb_gregset_t *) gregset);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) gregset);
target_store_registers (-1);
do_cleanups (old_chain);
@@ -270,7 +270,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
target_fetch_registers (-1);
- fill_fpregset ((gdb_fpregset_t *) fpregset, -1);
+ fill_fpregset (current_regcache, (gdb_fpregset_t *) fpregset, -1);
do_cleanups (old_chain);
return PS_OK;
@@ -287,8 +287,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
- /* FIXME: We should really make supply_fpregset const-correct. */
- supply_fpregset ((gdb_fpregset_t *) fpregset);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (-1);
do_cleanups (old_chain);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1250ff96dce..a6b43a2cd27 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -30,6 +30,7 @@ Boston, MA 02110-1301, USA. */
#include "elf-bfd.h" /* for elfcore_write_* */
#include "gdbcmd.h"
#include "gdbthread.h"
+#include "regcache.h"
#if defined (NEW_PROC_API)
#define _STRUCTURED_PROC 1 /* Should be done by configure script. */
@@ -3705,7 +3706,7 @@ procfs_fetch_registers (int regnum)
if (gregs == NULL)
proc_error (pi, "fetch_registers, get_gregs", __LINE__);
- supply_gregset (gregs);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) gregs);
if (FP0_REGNUM >= 0) /* Do we have an FPU? */
{
@@ -3720,7 +3721,7 @@ procfs_fetch_registers (int regnum)
if (fpregs == NULL)
proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
- supply_fpregset (fpregs);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregs);
}
}
@@ -3773,7 +3774,7 @@ procfs_store_registers (int regnum)
if (gregs == NULL)
proc_error (pi, "store_registers, get_gregs", __LINE__);
- fill_gregset (gregs, regnum);
+ fill_gregset (current_regcache, gregs, regnum);
if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__);
@@ -3790,7 +3791,7 @@ procfs_store_registers (int regnum)
if (fpregs == NULL)
proc_error (pi, "store_registers, get_fpregs", __LINE__);
- fill_fpregset (fpregs, regnum);
+ fill_fpregset (current_regcache, fpregs, regnum);
if (!proc_set_fpregs (pi))
proc_error (pi, "store_registers, set_fpregs", __LINE__);
}
@@ -6020,7 +6021,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
merged_pid = TIDGET (ptid) << 16 | PIDGET (ptid);
- fill_gregset (&gregs, -1);
+ fill_gregset (current_regcache, &gregs, -1);
#if defined (UNIXWARE)
note_data = (char *) elfcore_write_lwpstatus (obfd,
note_data,
@@ -6036,7 +6037,7 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
stop_signal,
&gregs);
#endif
- fill_fpregset (&fpregs, -1);
+ fill_fpregset (current_regcache, &fpregs, -1);
note_data = (char *) elfcore_write_prfpreg (obfd,
note_data,
note_size,
@@ -6107,7 +6108,7 @@ procfs_make_note_section (bfd *obfd, int *note_size)
psargs);
#ifdef UNIXWARE
- fill_gregset (&gregs, -1);
+ fill_gregset (current_regcache, &gregs, -1);
note_data = elfcore_write_pstatus (obfd, note_data, note_size,
PIDGET (inferior_ptid),
stop_signal, &gregs);
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index a7ccd747fb5..a167bb7279c 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -64,53 +64,53 @@
/* Fill GDB's register array with the general-purpose register values
in *REGP. */
void
-supply_gregset (gregset_t *regp)
+supply_gregset (struct regcache *regcache, const gregset_t *regp)
{
int i;
for (i = 0; i < S390_NUM_REGS; i++)
if (regmap_gregset[i] != -1)
- regcache_raw_supply (current_regcache, i,
- (char *)regp + regmap_gregset[i] + SUBOFF (i));
+ regcache_raw_supply (regcache, i,
+ (const char *)regp + regmap_gregset[i] + SUBOFF (i));
}
/* Fill register REGNO (if it is a general-purpose register) in
*REGP with the value in GDB's register array. If REGNO is -1,
do this for all registers. */
void
-fill_gregset (gregset_t *regp, int regno)
+fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
{
int i;
for (i = 0; i < S390_NUM_REGS; i++)
if (regmap_gregset[i] != -1)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i,
+ regcache_raw_collect (regcache, i,
(char *)regp + regmap_gregset[i] + SUBOFF (i));
}
/* Fill GDB's register array with the floating-point register values
in *REGP. */
void
-supply_fpregset (fpregset_t *regp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
{
int i;
for (i = 0; i < S390_NUM_REGS; i++)
if (regmap_fpregset[i] != -1)
- regcache_raw_supply (current_regcache, i,
- ((char *)regp) + regmap_fpregset[i]);
+ regcache_raw_supply (regcache, i,
+ (const char *)regp + regmap_fpregset[i]);
}
/* Fill register REGNO (if it is a general-purpose register) in
*REGP with the value in GDB's register array. If REGNO is -1,
do this for all registers. */
void
-fill_fpregset (fpregset_t *regp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *regp, int regno)
{
int i;
for (i = 0; i < S390_NUM_REGS; i++)
if (regmap_fpregset[i] != -1)
if (regno == -1 || regno == i)
- regcache_raw_collect (current_regcache, i,
- ((char *)regp) + regmap_fpregset[i]);
+ regcache_raw_collect (regcache, i,
+ (char *)regp + regmap_fpregset[i]);
}
/* Find the TID for the current inferior thread to use with ptrace. */
@@ -139,7 +139,7 @@ fetch_regs (int tid)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (&regs);
+ supply_gregset (current_regcache, (const gregset_t *) &regs);
}
/* Store all valid general-purpose registers in GDB's register cache
@@ -156,7 +156,7 @@ store_regs (int tid, int regnum)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (&regs, regnum);
+ fill_gregset (current_regcache, &regs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't write registers"));
@@ -176,7 +176,7 @@ fetch_fpregs (int tid)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (&fpregs);
+ supply_fpregset (current_regcache, (const fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register cache
@@ -193,7 +193,7 @@ store_fpregs (int tid, int regnum)
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (&fpregs, regnum);
+ fill_fpregset (current_regcache, &fpregs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't write floating point status"));
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 518f17f8a3f..bb8d20b6a65 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -531,8 +531,8 @@ sol_thread_fetch_registers (int regnum)
calling the td routines because the td routines call ps_lget*
which affect the values stored in the registers array. */
- supply_gregset ((gdb_gregset_t *) &gregset);
- supply_fpregset ((gdb_fpregset_t *) &fpregset);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) &gregset);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) &fpregset);
#if 0
/* FIXME: libthread_db doesn't seem to handle this right. */
@@ -618,8 +618,8 @@ sol_thread_store_registers (int regnum)
#endif
}
- fill_gregset ((gdb_gregset_t *) &gregset, regnum);
- fill_fpregset ((gdb_fpregset_t *) &fpregset, regnum);
+ fill_gregset (current_regcache, (gdb_gregset_t *) &gregset, regnum);
+ fill_fpregset (current_regcache, (gdb_fpregset_t *) &fpregset, regnum);
val = p_td_thr_setgregs (&thandle, gregset);
if (val != TD_OK)
@@ -1107,7 +1107,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
procfs_ops.to_fetch_registers (-1);
else
orig_core_ops.to_fetch_registers (-1);
- fill_gregset ((gdb_gregset_t *) gregset, -1);
+ fill_gregset (current_regcache, (gdb_gregset_t *) gregset, -1);
do_cleanups (old_chain);
@@ -1126,7 +1126,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- supply_gregset ((gdb_gregset_t *) gregset);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) gregset);
if (target_has_execution)
procfs_ops.to_store_registers (-1);
else
@@ -1239,7 +1239,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
procfs_ops.to_fetch_registers (-1);
else
orig_core_ops.to_fetch_registers (-1);
- fill_fpregset ((gdb_fpregset_t *) fpregset, -1);
+ fill_fpregset (current_regcache, (gdb_fpregset_t *) fpregset, -1);
do_cleanups (old_chain);
@@ -1258,7 +1258,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- supply_fpregset ((gdb_fpregset_t *) fpregset);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregset);
if (target_has_execution)
procfs_ops.to_store_registers (-1);
else
diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c
index 1e507d27535..0f63ad6c510 100644
--- a/gdb/sparc-linux-nat.c
+++ b/gdb/sparc-linux-nat.c
@@ -31,27 +31,27 @@
#include "linux-nat.h"
void
-supply_gregset (prgregset_t *gregs)
+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
{
- sparc32_supply_gregset (sparc_gregset, current_regcache, -1, gregs);
+ sparc32_supply_gregset (sparc_gregset, regcache, -1, gregs);
}
void
-supply_fpregset (prfpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc32_supply_fpregset (current_regcache, -1, fpregs);
+ sparc32_supply_fpregset (regcache, -1, fpregs);
}
void
-fill_gregset (prgregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
{
- sparc32_collect_gregset (sparc_gregset, current_regcache, regnum, gregs);
+ sparc32_collect_gregset (sparc_gregset, regcache, regnum, gregs);
}
void
-fill_fpregset (prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs, int regnum)
{
- sparc32_collect_fpregset (current_regcache, regnum, fpregs);
+ sparc32_collect_fpregset (regcache, regnum, fpregs);
}
void _initialialize_sparc_linux_nat (void);
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index da04b0c27f8..e4da7015f3e 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -74,25 +74,25 @@
#endif
void
-supply_gregset (prgregset_t *gregs)
+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
{
- sparc_supply_gregset (&sparc_sol2_gregset, current_regcache, -1, gregs);
+ sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
}
void
-supply_fpregset (prfpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc_supply_fpregset (current_regcache, -1, fpregs);
+ sparc_supply_fpregset (regcache, -1, fpregs);
}
void
-fill_gregset (prgregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
{
- sparc_collect_gregset (&sparc_sol2_gregset, current_regcache, regnum, gregs);
+ sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
}
void
-fill_fpregset (prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs, int regnum)
{
- sparc_collect_fpregset (current_regcache, regnum, fpregs);
+ sparc_collect_fpregset (regcache, regnum, fpregs);
}
diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c
index 03c1764fe38..924d639f1c8 100644
--- a/gdb/sparc64-linux-nat.c
+++ b/gdb/sparc64-linux-nat.c
@@ -47,27 +47,28 @@ static const struct sparc_gregset sparc64_linux_ptrace_gregset =
void
-supply_gregset (prgregset_t *gregs)
+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
{
- sparc64_supply_gregset (sparc_gregset, current_regcache, -1, gregs);
+ sparc64_supply_gregset (sparc_gregset, regcache, -1, gregs);
}
void
-supply_fpregset (prfpregset_t *fpregs)
+supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc64_supply_fpregset (current_regcache, -1, fpregs);
+ sparc64_supply_fpregset (regcache, -1, fpregs);
}
void
-fill_gregset (prgregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
{
- sparc64_collect_gregset (sparc_gregset, current_regcache, regnum, gregs);
+ sparc64_collect_gregset (sparc_gregset, regcache, regnum, gregs);
}
void
-fill_fpregset (prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache,
+ prfpregset_t *fpregs, int regnum)
{
- sparc64_collect_fpregset (current_regcache, regnum, fpregs);
+ sparc64_collect_fpregset (regcache, regnum, fpregs);
}
/* Provide a prototype to silence -Wmissing-prototypes. */