(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>
+
+ * 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
$(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)
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)
*/
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);
}
/*
*/
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);
}
*/
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);
}
/*
*/
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
\f
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);
}
\f
/* Determine if PT_GETREGS fetches this register. */
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
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. */
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
-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);
}
\f
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. */
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
+#include "regcache.h"
#include <fcntl.h>
#include <errno.h>
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (&gregset);
+ supply_gregset (current_regcache, (const gdb_gregset_t *) &gregset);
}
break;
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
if (FP0_REGNUM >= 0)
- supply_fpregset (&fpregset);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) &fpregset);
}
break;
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
/* 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
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
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);
}
}
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;
if (regno == -1 || regno == mregno)
{
- regcache_raw_collect(current_regcache, mregno, &(*gregsetp)[i]);
+ regcache_raw_collect(regcache, mregno, &(*gregsetp)[i]);
}
}
}
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);
}
}
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;
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);
}
}
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);
}
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);
}
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (®s);
+ supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register array
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (®s, regno);
+ fill_gregset (current_regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
*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
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
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
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"));
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
-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
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;
}
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"));
};
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
};
#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
+#define CREG_ADDR(state, regnum) ((const char *)(state) + reg_offset[regnum])
\f
/* Get the whole floating-point state of THREAD and record the values
/* 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
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
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 */
*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
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 */
}
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++)
{
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);
}
}
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]));
}
}
*/
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];
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
}
*/
void
-supply_fpregset (fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
int regi;
static char zerobuf[32] = {0};
/* 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
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;
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);
}
}
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);
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,
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,
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,
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;
}
if (i != M32R_SP_REGNUM)
- regcache_raw_supply (current_regcache, i, ®val);
+ regcache_raw_supply (regcache, i, ®val);
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);
}
}
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (®s);
+ supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
}
/* Fill register REGNO (if it is a general-purpose register) in
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;
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);
}
}
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (®s, regno);
+ fill_gregset (current_regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
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)
{
}
\f
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 *) ®p[regmap[regi]]);
- regcache_raw_supply (current_regcache, PS_REGNUM, (char *) ®p[PT_SR]);
- regcache_raw_supply (current_regcache, PC_REGNUM, (char *) ®p[PT_PC]);
+ regcache_raw_supply (regcache, regi, ®p[regmap[regi]]);
+ regcache_raw_supply (regcache, PS_REGNUM, ®p[PT_SR]);
+ regcache_raw_supply (regcache, PC_REGNUM, ®p[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
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (®s);
+ supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register array
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (®s, regno);
+ fill_gregset (current_regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
/* 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
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
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
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"));
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (&gregset);
+ supply_gregset (current_regcache, (const elf_gregset_t *) &gregset);
}
break;
else
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
- supply_fpregset (&fpregset);
+ supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregset);
}
break;
/* 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);
}
}
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;
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));
}
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);
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)
#include "inferior.h"
#include "symtab.h"
#include "target.h"
+#include "regcache.h"
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
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;
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);
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;
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);
#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. */
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? */
{
if (fpregs == NULL)
proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
- supply_fpregset (fpregs);
+ supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregs);
}
}
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__);
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__);
}
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,
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,
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);
/* 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. */
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (®s);
+ supply_gregset (current_regcache, (const gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register cache
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (®s, regnum);
+ fill_gregset (current_regcache, ®s, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't write registers"));
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
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"));
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. */
#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)
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);
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
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);
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
#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);
#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);
}
\f
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. */