2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
+ * target.h (struct regcache): Add forward declaration.
+ (struct target_ops): Add REGCACHE parameter to to_fetch_registers
+ and to_store_registers target operations.
+ (target_fetch_registers, target_store_registers): Update.
+
+ * regcache.c (regcache_raw_read): Replace register_cached by
+ regcache_valid_p. Pass regcache to target_fetch_registers.
+ (regcache_raw_write): Pass regcache to target_store_registers.
+
+ * arm-linux-nat.c (store_fpregister, store_fpregs, store_register,
+ store_regs, store_wmmx_regs): Replace register_cached by
+ regcache_valid_p.
+
+ * bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd): Pass current_regcache
+ to target_fetch_registers calls.
+ * corelow.c (core_open): Likewise.
+ * linux-nat.c (linux_nat_corefile_thread_callback): Likewise.
+ * proc-service.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs,
+ ps_lsetfpregs): Likewise.
+ * sol-thread.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs,
+ ps_lsetfpregs): Likewise.
+ * win32-nat.c (win32_resume): Likewise.
+ * ia64-tdep.c (ia64_store_return_value): Pass current_regcache
+ to target_store_registers call.
+ * rs6000-tdep.c (rs6000_push_dummy_call): Likewise.
+
+ * inferior.h (store_inferior_registers): Update prototype.
+ (fetch_inferior_registers): Likewise.
+ * gnu-nat.c (gnu_store_registers, gnu_fetch_registers): Likewise.
+ * mips-linux-nat.c (super_fetch_registers, super_store_registers):
+ Update function pointer signatures.
+
+ * aix-thread.c (aix_thread_fetch_registers): Add REGCACHE parameter,
+ use it instead of current_regcache, update calls.
+ (aix_thread_store_registers): Likewise.
+ * alphabsd-nat.c (alphabsd_fetch_inferior_registers): Likewise.
+ (alphabsd_store_inferior_registers): Likewise.
+ * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise.
+ (amd64bsd_store_inferior_registers): Likewise.
+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise.
+ (amd64_linux_store_inferior_registers): Likewise.
+ * arm-linux-nat.c (fetch_fpregister, fetch_fpregs, store_fpregister,
+ store_fpregs, fetch_register, fetch_regs, store_register, store_regs,
+ fetch_wmmx_regs, store_wmmx_regs): Likewise.
+ (arm_linux_fetch_inferior_registers): Likewise.
+ (arm_linux_store_inferior_registers): Likewise.
+ * armnbsd-nat.c (fetch_register, fetch_regs, fetch_fp_register,
+ fetch_fp_regs, armnbsd_fetch_registers): Likewise.
+ (store_register, store_regs, store_fp_register, store_fp_regs,
+ armnbsd_store_registers): Likewise.
+ * bsd-kvm.c (bsd_kvm_fetch_pcb, bsd_kvm_fetch_registers): Likewise.
+ * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise.
+ (bsd_uthread_store_registers): Likewise.
+ * corelow.c (get_core_registers): Likewise.
+ * go32-nat.c (fetch_register, go32_fetch_registers, store_register,
+ go32_store_registers): Likewise.
+ * hppabsd-nat.c (hppabsd_fetch_registers): Likewise.
+ (hppabsd_store_registers): Likewise.
+ * hppa-hpux-nat.c (hppa_hpux_fetch_register): Likewise.
+ (hppa_hpux_fetch_inferior_registers): Likewise.
+ (hppa_hpux_store_register): Likewise.
+ (hppa_hpux_store_inferior_registers): Likewise.
+ * hppa-linux-nat.c (fetch_register, store_register): Likewise.
+ (hppa_linux_fetch_inferior_registers): Likewise.
+ (hppa_linux_store_inferior_registers): Likewise.
+ * hpux-thread.c (hpux_thread_fetch_registers): Likewise.
+ (hpux_thread_store_registers): Likewise.
+ * i386bsd-nat.c (i386bsd_fetch_inferior_registers): Likewise.
+ (i386bsd_store_inferior_registers): Likewise.
+ * i386gnu-nat.c (fetch_fpregs, gnu_fetch_registers, store_fpregs,
+ gnu_store_registers): Likewise.
+ * i386-linux-nat.c (fetch_register, store_register, fetch_regs,
+ store_regs, fetch_fpregs, store_fpregs, fetch_fpxregs, store_fpxregs):
+ Likewise.
+ (i386_linux_fetch_inferior_registers): Likewise.
+ (i386_linux_store_inferior_registers): Likewise.
+ * ia64-linux-nat.c (ia64_linux_fetch_register): Likewise.
+ (ia64_linux_fetch_registers): Likewise.
+ (ia64_linux_store_register): Likewise.
+ (ia64_linux_store_registers): Likewise.
+ * inf-child.c (inf_child_fetch_inferior_registers): Likewise.
+ (inf_child_store_inferior_registers): Likewise.
+ * inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
+ (inf_ptrace_fetch_registers): Likewise.
+ (inf_ptrace_store_register): Likewise.
+ (inf_ptrace_store_registers): Likewise.
+ * infptrace.c (fetch_register, store_register): Likewise.
+ (fetch_inferior_registers, store_inferior_registers): Likewise.
+ * m32r-linux-nat.c (fetch_regs, store_regs): Likewise.
+ (m32r_linux_fetch_inferior_registers): Likewise.
+ (m32r_linux_store_inferior_registers): Likewise.
+ * m68kbsd-nat.c (m68kbsd_fetch_inferior_registers): Likewise.
+ (m68kbsd_store_inferior_registers): Likewise.
+ * m68klinux-nat.c (fetch_register, old_fetch_inferior_registers,
+ store_register, old_store_inferior_registers, fetch_regs, store_regs,
+ fetch_fpregs, store_fpregs): Likewise.
+ (m68k_linux_fetch_inferior_registers): Likewise.
+ (m68k_linux_store_inferior_registers): Likewise.
+ * m88kbsd-nat.c (m88kbsd_fetch_inferior_registers): Likewise.
+ (m88kbsd_store_inferior_registers): Likewise.
+ * mips64obsd-nat.c (mips64obsd_fetch_inferior_registers): Likewise.
+ (mips64obsd_store_inferior_registers): Likewise.
+ * mips-linux-nat.c (mips64_linux_regsets_fetch_registers): Likewise.
+ (mips64_linux_regsets_store_registers): Likewise.
+ (mips64_linux_fetch_registers): Likewise.
+ (mips64_linux_store_registers): Likewise.
+ * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise.
+ (mipsnbsd_store_inferior_registers): Likewise.
+ * monitor.c (monitor_fetch_register, monitor_store_register): Likewise.
+ (monitor_fetch_registers, monitor_store_registers): Likewise.
+ * nto-procfs.c (procfs_fetch_registers): Likewise.
+ (procfs_store_registers): Likewise.
+ * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register,
+ fetch_register, supply_vrregset, fetch_altivec_registers,
+ fetch_ppc_registers, ppc_linux_fetch_inferior_registers): Likewise.
+ (store_altivec_register, store_spe_register, store_register,
+ fill_vrregset, store_altivec_registers, store_ppc_registers,
+ ppc_linux_store_inferior_registers): Likewise.
+ * ppcnbsd-nat.c (ppcnbsd_fetch_inferior_registers): Likewise.
+ (ppcnbsd_store_inferior_registers): Likewise.
+ * ppcobsd-nat.c (ppcobsd_fetch_registers): Likewise.
+ (ppcobsd_store_registers): Likewise.
+ * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
+ * remote.c (fetch_register_using_p, process_g_packet,
+ fetch_registers_using_g, remote_fetch_registers): Likewise.
+ (store_register_using_P, store_registers_using_G,
+ remote_store_registers): Likewise.
+ * remote-m32r-sdi.c (m32r_fetch_registers, m32r_fetch_register,
+ m32r_store_register, m32r_store_register): Likewise.
+ * remote-mips.c (mips_fetch_registers, mips_store_registers): Likewise.
+ * remote-sim.c (gdbsim_fetch_register): Likewise.
+ (gdbsim_store_register): Likewise.
+ * rs6000-nat.c (fetch_register, store_register): Likewise.
+ (rs6000_fetch_inferior_registers): Likewise.
+ (rs6000_store_inferior_registers): Likewise.
+ * s390-nat.c (fetch_regs, store_regs): Likewise.
+ (fetch_fpregs, store_fpregs): Likewise.
+ (s390_linux_fetch_inferior_registers): Likewise.
+ (s390_linux_store_inferior_registers): Likewise.
+ * shnbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise.
+ (shnbsd_store_inferior_registers): Likewise.
+ * sol-thread.c (sol_thread_fetch_registers): Likewise.
+ (sol_thread_store_registers): Likewise.
+ * sparc-nat.c (fetch_inferior_registers): Likewise.
+ (store_inferior_registers): Likewise.
+ * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise.
+ (spu_store_inferior_registers): Likewise.
+ * target.c (debug_print_register): Likewise.
+ (debug_to_fetch_registers, debug_to_store_registers): Likewise.
+ * vaxbsd-nat.c (vaxbsd_fetch_inferior_registers): Likewise.
+ (vaxbsd_store_inferior_registers): Likewise.
+ * win32-nat.c (do_win32_fetch_inferior_registers): Likewise.
+ (win32_fetch_inferior_registers): Likewise.
+ (win32_store_inferior_registers): Likewise.
+
+2007-05-06 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdbcore.h (struct regcache): Add forward declaration.
(struct core_fns): Add REGCACHE argument to core_read_registers
callback.
thread/process specified by inferior_ptid. */
static void
-aix_thread_fetch_registers (int regno)
+aix_thread_fetch_registers (struct regcache *regcache, int regno)
{
struct thread_info *thread;
pthdb_tid_t tid;
if (!PD_TID (inferior_ptid))
- base_target.to_fetch_registers (regno);
+ base_target.to_fetch_registers (regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)
- fetch_regs_user_thread (current_regcache, thread->private->pdtid);
+ fetch_regs_user_thread (regcache, thread->private->pdtid);
else
- fetch_regs_kernel_thread (current_regcache, regno, tid);
+ fetch_regs_kernel_thread (regcache, regno, tid);
}
}
thread/process specified by inferior_ptid. */
static void
-aix_thread_store_registers (int regno)
+aix_thread_store_registers (struct regcache *regcache, int regno)
{
struct thread_info *thread;
pthdb_tid_t tid;
if (!PD_TID (inferior_ptid))
- base_target.to_store_registers (regno);
+ base_target.to_store_registers (regcache, regno);
else
{
thread = find_thread_pid (inferior_ptid);
tid = thread->private->tid;
if (tid == PTHDB_INVALID_TID)
- store_regs_user_thread (current_regcache, thread->private->pdtid);
+ store_regs_user_thread (regcache, thread->private->pdtid);
else
- store_regs_kernel_thread (current_regcache, regno, tid);
+ store_regs_kernel_thread (regcache, regno, tid);
}
}
for all registers (including the floating point registers). */
static void
-alphabsd_fetch_inferior_registers (int regno)
+alphabsd_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- alphabsd_supply_reg (current_regcache, (char *) &gregs, regno);
+ alphabsd_supply_reg (regcache, (char *) &gregs, regno);
if (regno != -1)
return;
}
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- alphabsd_supply_fpreg (current_regcache, (char *) &fpregs, regno);
+ alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno);
}
}
this for all registers (including the floating point registers). */
static void
-alphabsd_store_inferior_registers (int regno)
+alphabsd_store_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- alphabsd_fill_reg (current_regcache, (char *) &gregs, regno);
+ alphabsd_fill_reg (regcache, (char *) &gregs, regno);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- alphabsd_fill_fpreg (current_regcache, (char *) &fpregs, regno);
+ alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
registers). */
static void
-amd64_linux_fetch_inferior_registers (int regnum)
+amd64_linux_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
int tid;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- amd64_supply_native_gregset (current_regcache, ®s, -1);
+ amd64_supply_native_gregset (regcache, ®s, -1);
if (regnum != -1)
return;
}
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- amd64_supply_fxsave (current_regcache, -1, &fpregs);
+ amd64_supply_fxsave (regcache, -1, &fpregs);
}
}
registers). */
static void
-amd64_linux_store_inferior_registers (int regnum)
+amd64_linux_store_inferior_registers (struct regcache *regcache, int regnum)
{
int tid;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- amd64_collect_native_gregset (current_regcache, ®s, regnum);
+ amd64_collect_native_gregset (regcache, ®s, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (long) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- amd64_collect_fxsave (current_regcache, regnum, &fpregs);
+ amd64_collect_fxsave (regcache, regnum, &fpregs);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
for all registers (including the floating-point registers). */
static void
-amd64bsd_fetch_inferior_registers (int regnum)
+amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- amd64_supply_native_gregset (current_regcache, ®s, -1);
+ amd64_supply_native_gregset (regcache, ®s, -1);
if (regnum != -1)
return;
}
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- amd64_supply_fxsave (current_regcache, -1, &fpregs);
+ amd64_supply_fxsave (regcache, -1, &fpregs);
}
}
this for all registers (including the floating-point registers). */
static void
-amd64bsd_store_inferior_registers (int regnum)
+amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- amd64_collect_native_gregset (current_regcache, ®s, regnum);
+ amd64_collect_native_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- amd64_collect_fxsave (current_regcache, regnum, &fpregs);
+ amd64_collect_fxsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
state of the process and store it into regcache. */
static void
-fetch_fpregister (int regno)
+fetch_fpregister (struct regcache *regcache, int regno)
{
int ret, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Fetch fpsr. */
if (ARM_FPS_REGNUM == regno)
- regcache_raw_supply (current_regcache, ARM_FPS_REGNUM,
+ regcache_raw_supply (regcache, ARM_FPS_REGNUM,
fp + NWFPE_FPSR_OFFSET);
/* Fetch the floating point register. */
if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
- supply_nwfpe_register (current_regcache, regno, fp);
+ supply_nwfpe_register (regcache, regno, fp);
}
/* Get the whole floating point state of the process and store it
into regcache. */
static void
-fetch_fpregs (void)
+fetch_fpregs (struct regcache *regcache)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
}
/* Fetch fpsr. */
- regcache_raw_supply (current_regcache, ARM_FPS_REGNUM,
+ regcache_raw_supply (regcache, ARM_FPS_REGNUM,
fp + NWFPE_FPSR_OFFSET);
/* Fetch the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- supply_nwfpe_register (current_regcache, regno, fp);
+ supply_nwfpe_register (regcache, regno, fp);
}
/* Save a particular register into the floating point state of the
process using the contents from regcache. */
static void
-store_fpregister (int regno)
+store_fpregister (const struct regcache *regcache, int regno)
{
int ret, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
}
/* Store fpsr. */
- if (ARM_FPS_REGNUM == regno && register_cached (ARM_FPS_REGNUM))
- regcache_raw_collect (current_regcache, ARM_FPS_REGNUM,
- fp + NWFPE_FPSR_OFFSET);
+ if (ARM_FPS_REGNUM == regno && regcache_valid_p (regcache, ARM_FPS_REGNUM))
+ regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
/* Store the floating point register. */
if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
- collect_nwfpe_register (current_regcache, regno, fp);
+ collect_nwfpe_register (regcache, regno, fp);
ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
if (ret < 0)
the contents from regcache. */
static void
-store_fpregs (void)
+store_fpregs (const struct regcache *regcache)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
}
/* Store fpsr. */
- if (register_cached (ARM_FPS_REGNUM))
- regcache_raw_collect (current_regcache, ARM_FPS_REGNUM,
- fp + NWFPE_FPSR_OFFSET);
+ if (regcache_valid_p (regcache, ARM_FPS_REGNUM))
+ regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
/* Store the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- if (register_cached (regno))
- collect_nwfpe_register (current_regcache, regno, fp);
+ if (regcache_valid_p (regcache, regno))
+ collect_nwfpe_register (regcache, regno, fp);
ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
if (ret < 0)
regcache. */
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
int ret, tid;
elf_gregset_t regs;
}
if (regno >= ARM_A1_REGNUM && regno < ARM_PC_REGNUM)
- regcache_raw_supply (current_regcache, regno, (char *) ®s[regno]);
+ regcache_raw_supply (regcache, regno, (char *) ®s[regno]);
if (ARM_PS_REGNUM == regno)
{
if (arm_apcs_32)
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_CPSR_REGNUM]);
else
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
}
if (ARM_PC_REGNUM == regno)
{
regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
- regcache_raw_supply (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_supply (regcache, ARM_PC_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
}
}
regcache. */
static void
-fetch_regs (void)
+fetch_regs (struct regcache *regcache)
{
int ret, regno, tid;
elf_gregset_t regs;
}
for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
- regcache_raw_supply (current_regcache, regno, (char *) ®s[regno]);
+ regcache_raw_supply (regcache, regno, (char *) ®s[regno]);
if (arm_apcs_32)
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_CPSR_REGNUM]);
else
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
- regcache_raw_supply (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_supply (regcache, ARM_PC_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
}
regcache. */
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
int ret, tid;
elf_gregset_t regs;
- if (!register_cached (regno))
+ if (!regcache_valid_p (regcache, regno))
return;
/* Get the thread id for the ptrace call. */
}
if (regno >= ARM_A1_REGNUM && regno <= ARM_PC_REGNUM)
- regcache_raw_collect (current_regcache, regno, (char *) ®s[regno]);
+ regcache_raw_collect (regcache, regno, (char *) ®s[regno]);
else if (arm_apcs_32 && regno == ARM_PS_REGNUM)
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) ®s[ARM_CPSR_REGNUM]);
else if (!arm_apcs_32 && regno == ARM_PS_REGNUM)
- regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
}
static void
-store_regs (void)
+store_regs (const struct regcache *regcache)
{
int ret, regno, tid;
elf_gregset_t regs;
for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
{
- if (register_cached (regno))
- regcache_raw_collect (current_regcache, regno, (char *) ®s[regno]);
+ if (regcache_valid_p (regcache, regno))
+ regcache_raw_collect (regcache, regno, (char *) ®s[regno]);
}
- if (arm_apcs_32 && register_cached (ARM_PS_REGNUM))
- regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ if (arm_apcs_32 && regcache_valid_p (regcache, ARM_PS_REGNUM))
+ regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_CPSR_REGNUM]);
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
#define IWMMXT_REGS_SIZE (16 * 8 + 6 * 4)
static void
-fetch_wmmx_regs (void)
+fetch_wmmx_regs (struct regcache *regcache)
{
char regbuf[IWMMXT_REGS_SIZE];
int ret, regno, tid;
}
for (regno = 0; regno < 16; regno++)
- regcache_raw_supply (current_regcache, regno + ARM_WR0_REGNUM,
+ regcache_raw_supply (regcache, regno + ARM_WR0_REGNUM,
®buf[regno * 8]);
for (regno = 0; regno < 2; regno++)
- regcache_raw_supply (current_regcache, regno + ARM_WCSSF_REGNUM,
+ regcache_raw_supply (regcache, regno + ARM_WCSSF_REGNUM,
®buf[16 * 8 + regno * 4]);
for (regno = 0; regno < 4; regno++)
- regcache_raw_supply (current_regcache, regno + ARM_WCGR0_REGNUM,
+ regcache_raw_supply (regcache, regno + ARM_WCGR0_REGNUM,
®buf[16 * 8 + 2 * 4 + regno * 4]);
}
static void
-store_wmmx_regs (void)
+store_wmmx_regs (const struct regcache *regcache)
{
char regbuf[IWMMXT_REGS_SIZE];
int ret, regno, tid;
}
for (regno = 0; regno < 16; regno++)
- if (register_cached (regno + ARM_WR0_REGNUM))
- regcache_raw_collect (current_regcache, regno + ARM_WR0_REGNUM,
+ if (regcache_valid_p (regcache, regno + ARM_WR0_REGNUM))
+ regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM,
®buf[regno * 8]);
for (regno = 0; regno < 2; regno++)
- if (register_cached (regno + ARM_WCSSF_REGNUM))
- regcache_raw_collect (current_regcache, regno + ARM_WCSSF_REGNUM,
+ if (regcache_valid_p (regcache, regno + ARM_WCSSF_REGNUM))
+ regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM,
®buf[16 * 8 + regno * 4]);
for (regno = 0; regno < 4; regno++)
- if (register_cached (regno + ARM_WCGR0_REGNUM))
- regcache_raw_collect (current_regcache, regno + ARM_WCGR0_REGNUM,
+ if (regcache_valid_p (regcache, regno + ARM_WCGR0_REGNUM))
+ regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM,
®buf[16 * 8 + 2 * 4 + regno * 4]);
ret = ptrace (PTRACE_SETWMMXREGS, tid, 0, regbuf);
point registers depending upon the value of regno. */
static void
-arm_linux_fetch_inferior_registers (int regno)
+arm_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- fetch_regs ();
- fetch_fpregs ();
+ fetch_regs (regcache);
+ fetch_fpregs (regcache);
if (arm_linux_has_wmmx_registers)
- fetch_wmmx_regs ();
+ fetch_wmmx_regs (regcache);
}
else
{
if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
- fetch_register (regno);
+ fetch_register (regcache, regno);
else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM)
- fetch_fpregister (regno);
+ fetch_fpregister (regcache, regno);
else if (arm_linux_has_wmmx_registers
&& regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
- fetch_wmmx_regs ();
+ fetch_wmmx_regs (regcache);
}
}
point registers depending upon the value of regno. */
static void
-arm_linux_store_inferior_registers (int regno)
+arm_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- store_regs ();
- store_fpregs ();
+ store_regs (regcache);
+ store_fpregs (regcache);
if (arm_linux_has_wmmx_registers)
- store_wmmx_regs ();
+ store_wmmx_regs (regcache);
}
else
{
if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
- store_register (regno);
+ store_register (regcache, regno);
else if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM))
- store_fpregister (regno);
+ store_fpregister (regcache, regno);
else if (arm_linux_has_wmmx_registers
&& regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
- store_wmmx_regs ();
+ store_wmmx_regs (regcache);
}
}
}
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
struct reg inferior_registers;
int ret;
switch (regno)
{
case ARM_SP_REGNUM:
- regcache_raw_supply (current_regcache, ARM_SP_REGNUM,
+ regcache_raw_supply (regcache, ARM_SP_REGNUM,
(char *) &inferior_registers.r_sp);
break;
case ARM_LR_REGNUM:
- regcache_raw_supply (current_regcache, ARM_LR_REGNUM,
+ regcache_raw_supply (regcache, ARM_LR_REGNUM,
(char *) &inferior_registers.r_lr);
break;
case ARM_PC_REGNUM:
/* This is ok: we're running native... */
inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc);
- regcache_raw_supply (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_supply (regcache, ARM_PC_REGNUM,
(char *) &inferior_registers.r_pc);
break;
case ARM_PS_REGNUM:
if (arm_apcs_32)
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) &inferior_registers.r_cpsr);
else
- regcache_raw_supply (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) &inferior_registers.r_pc);
break;
default:
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
(char *) &inferior_registers.r[regno]);
break;
}
}
static void
-fetch_regs (void)
+fetch_regs (struct regcache *regcache)
{
struct reg inferior_registers;
int ret;
return;
}
- arm_supply_gregset (current_regcache, &inferior_registers);
+ arm_supply_gregset (regcache, &inferior_registers);
}
static void
-fetch_fp_register (int regno)
+fetch_fp_register (struct regcache *regcache, int regno)
{
struct fpreg inferior_fp_registers;
int ret;
switch (regno)
{
case ARM_FPS_REGNUM:
- regcache_raw_supply (current_regcache, ARM_FPS_REGNUM,
+ regcache_raw_supply (regcache, ARM_FPS_REGNUM,
(char *) &inferior_fp_registers.fpr_fpsr);
break;
default:
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
(char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
break;
}
}
static void
-fetch_fp_regs (void)
+fetch_fp_regs (struct regcache *regcache)
{
struct fpreg inferior_fp_registers;
int ret;
return;
}
- arm_supply_fparegset (current_regcache, &inferior_fp_registers);
+ arm_supply_fparegset (regcache, &inferior_fp_registers);
}
static void
-armnbsd_fetch_registers (int regno)
+armnbsd_fetch_registers (struct regcache *regcache, int regno)
{
if (regno >= 0)
{
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
- fetch_register (regno);
+ fetch_register (regcache, regno);
else
- fetch_fp_register (regno);
+ fetch_fp_register (regcache, regno);
}
else
{
- fetch_regs ();
- fetch_fp_regs ();
+ fetch_regs (regcache);
+ fetch_fp_regs (regcache);
}
}
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
struct reg inferior_registers;
int ret;
switch (regno)
{
case ARM_SP_REGNUM:
- regcache_raw_collect (current_regcache, ARM_SP_REGNUM,
+ regcache_raw_collect (regcache, ARM_SP_REGNUM,
(char *) &inferior_registers.r_sp);
break;
case ARM_LR_REGNUM:
- regcache_raw_collect (current_regcache, ARM_LR_REGNUM,
+ regcache_raw_collect (regcache, ARM_LR_REGNUM,
(char *) &inferior_registers.r_lr);
break;
case ARM_PC_REGNUM:
if (arm_apcs_32)
- regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &inferior_registers.r_pc);
else
{
unsigned pc_val;
- regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &pc_val);
pc_val = ADDR_BITS_REMOVE (pc_val);
case ARM_PS_REGNUM:
if (arm_apcs_32)
- regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &inferior_registers.r_cpsr);
else
{
unsigned psr_val;
- regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &psr_val);
psr_val ^= ADDR_BITS_REMOVE (psr_val);
break;
default:
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) &inferior_registers.r[regno]);
break;
}
}
static void
-store_regs (void)
+store_regs (const struct regcache *regcache)
{
struct reg inferior_registers;
int ret;
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) &inferior_registers.r[regno]);
- regcache_raw_collect (current_regcache, ARM_SP_REGNUM,
+ regcache_raw_collect (regcache, ARM_SP_REGNUM,
(char *) &inferior_registers.r_sp);
- regcache_raw_collect (current_regcache, ARM_LR_REGNUM,
+ regcache_raw_collect (regcache, ARM_LR_REGNUM,
(char *) &inferior_registers.r_lr);
if (arm_apcs_32)
{
- regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &inferior_registers.r_pc);
- regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &inferior_registers.r_cpsr);
}
else
unsigned pc_val;
unsigned psr_val;
- regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &pc_val);
- regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &psr_val);
pc_val = ADDR_BITS_REMOVE (pc_val);
}
static void
-store_fp_register (int regno)
+store_fp_register (const struct regcache *regcache, int regno)
{
struct fpreg inferior_fp_registers;
int ret;
switch (regno)
{
case ARM_FPS_REGNUM:
- regcache_raw_collect (current_regcache, ARM_FPS_REGNUM,
+ regcache_raw_collect (regcache, ARM_FPS_REGNUM,
(char *) &inferior_fp_registers.fpr_fpsr);
break;
default:
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
break;
}
}
static void
-store_fp_regs (void)
+store_fp_regs (const struct regcache *regcache)
{
struct fpreg inferior_fp_registers;
int ret;
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
- regcache_raw_collect (current_regcache, ARM_FPS_REGNUM,
+ regcache_raw_collect (regcache, ARM_FPS_REGNUM,
(char *) &inferior_fp_registers.fpr_fpsr);
ret = ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
}
static void
-armnbsd_store_registers (int regno)
+armnbsd_store_registers (struct regcache *regcache, int regno)
{
if (regno >= 0)
{
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
- store_register (regno);
+ store_register (regcache, regno);
else
- store_fp_register (regno);
+ store_fp_register (regcache, regno);
}
else
{
- store_regs ();
- store_fp_regs ();
+ store_regs (regcache);
+ store_fp_regs (regcache);
}
}
core_kd = temp_kd;
push_target (&bsd_kvm_ops);
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), -1, 1);
/* Fetch process control block at address PADDR. */
static int
-bsd_kvm_fetch_pcb (struct pcb *paddr)
+bsd_kvm_fetch_pcb (struct regcache *regcache, struct pcb *paddr)
{
struct pcb pcb;
error (("%s"), kvm_geterr (core_kd));
gdb_assert (bsd_kvm_supply_pcb);
- return bsd_kvm_supply_pcb (current_regcache, &pcb);
+ return bsd_kvm_supply_pcb (regcache, &pcb);
}
static void
-bsd_kvm_fetch_registers (int regnum)
+bsd_kvm_fetch_registers (struct regcache *regcache, int regnum)
{
struct nlist nl[2];
if (bsd_kvm_paddr)
{
- bsd_kvm_fetch_pcb (bsd_kvm_paddr);
+ bsd_kvm_fetch_pcb (regcache, bsd_kvm_paddr);
return;
}
{
/* Found dumppcb. If it contains a valid context, return
immediately. */
- if (bsd_kvm_fetch_pcb ((struct pcb *) nl[0].n_value))
+ if (bsd_kvm_fetch_pcb (regcache, (struct pcb *) nl[0].n_value))
return;
}
if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1)
error (("%s"), kvm_geterr (core_kd));
- bsd_kvm_fetch_pcb (paddr);
+ bsd_kvm_fetch_pcb (regcache, paddr);
return;
}
if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1)
error (("%s"), kvm_geterr (core_kd));
- bsd_kvm_fetch_pcb (paddr);
+ bsd_kvm_fetch_pcb (regcache, paddr);
return;
}
#endif
if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
error (("%s"), kvm_geterr (core_kd));
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), -1, 1);
bsd_kvm_paddr = (struct pcb *)(u_long) parse_and_eval_address (arg);
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), -1, 1);
}
static void
-bsd_uthread_fetch_registers (int regnum)
+bsd_uthread_fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = current_gdbarch;
struct bsd_uthread_ops *ops = gdbarch_data (gdbarch, bsd_uthread_data);
CORE_ADDR active_addr;
/* Always fetch the appropriate registers from the layer beneath. */
- find_target_beneath (bsd_uthread_ops_hack)->to_fetch_registers (regnum);
+ find_target_beneath (bsd_uthread_ops_hack)->to_fetch_registers (regcache, regnum);
/* FIXME: That might have gotten us more than we asked for. Make
sure we overwrite all relevant registers with values from the
if (addr != 0 && addr != active_addr)
{
bsd_uthread_check_magic (addr);
- ops->supply_uthread (current_regcache, regnum,
+ ops->supply_uthread (regcache, regnum,
addr + bsd_uthread_thread_ctx_offset);
}
}
static void
-bsd_uthread_store_registers (int regnum)
+bsd_uthread_store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = current_gdbarch;
struct bsd_uthread_ops *ops = gdbarch_data (gdbarch, bsd_uthread_data);
if (addr != 0 && addr != active_addr)
{
bsd_uthread_check_magic (addr);
- ops->collect_uthread (current_regcache, regnum,
+ ops->collect_uthread (regcache, regnum,
addr + bsd_uthread_thread_ctx_offset);
}
else
{
/* Updating the thread that is currently running; pass the
request to the layer beneath. */
- find_target_beneath (bsd_uthread_ops_hack)->to_store_registers (regnum);
+ find_target_beneath (bsd_uthread_ops_hack)->to_store_registers (regcache, regnum);
}
}
static void core_close_cleanup (void *ignore);
-static void get_core_registers (int);
+static void get_core_registers (struct regcache *, int);
static void add_to_thread_list (bfd *, asection *, void *);
if (ontop)
{
/* Fetch all registers from core file. */
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
/* Now, set up the frame cache, and print the top of stack. */
reinit_frame_cache ();
/* We just get all the registers, so we don't use regno. */
static void
-get_core_registers (int regno)
+get_core_registers (struct regcache *regcache, int regno)
{
int status;
return;
}
- get_core_register_section (current_regcache,
+ get_core_register_section (regcache,
".reg", 0, "general-purpose", 1);
- get_core_register_section (current_regcache,
+ get_core_register_section (regcache,
".reg2", 2, "floating-point", 0);
- get_core_register_section (current_regcache,
+ get_core_register_section (regcache,
".reg-xfp", 3, "extended floating-point", 0);
deprecated_registers_fetched ();
}
\f
-extern void gnu_store_registers (int regno);
-extern void gnu_fetch_registers (int regno);
+extern void gnu_store_registers (struct regcache *regcache, int regno);
+extern void gnu_fetch_registers (struct regcache *regcache, int regno);
struct target_ops gnu_ops;
enum target_signal siggnal);
static ptid_t go32_wait (ptid_t ptid,
struct target_waitstatus *status);
-static void go32_fetch_registers (int regno);
-static void store_register (int regno);
-static void go32_store_registers (int regno);
+static void go32_fetch_registers (struct regcache *, int regno);
+static void store_register (const struct regcache *, int regno);
+static void go32_store_registers (struct regcache *, int regno);
static void go32_prepare_to_store (void);
static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
int write,
}
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
if (regno < FP0_REGNUM)
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
(char *) &a_tss + regno_mapping[regno].tss_ofs);
else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
- i387_supply_fsave (current_regcache, regno, &npx);
+ i387_supply_fsave (regcache, regno, &npx);
else
internal_error (__FILE__, __LINE__,
_("Invalid register no. %d in fetch_register."), regno);
}
static void
-go32_fetch_registers (int regno)
+go32_fetch_registers (struct regcache *regcache, int regno)
{
if (regno >= 0)
- fetch_register (regno);
+ fetch_register (regcache, regno);
else
{
for (regno = 0; regno < FP0_REGNUM; regno++)
- fetch_register (regno);
- i387_supply_fsave (current_regcache, -1, &npx);
+ fetch_register (regcache, regno);
+ i387_supply_fsave (regcache, -1, &npx);
}
}
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
if (regno < FP0_REGNUM)
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
(char *) &a_tss + regno_mapping[regno].tss_ofs);
else if (i386_fp_regnum_p (regno) || i386_fpc_regnum_p (regno))
- i387_collect_fsave (current_regcache, regno, &npx);
+ i387_collect_fsave (regcache, regno, &npx);
else
internal_error (__FILE__, __LINE__,
_("Invalid register no. %d in store_register."), regno);
}
static void
-go32_store_registers (int regno)
+go32_store_registers (struct regcache *regcache, int regno)
{
unsigned r;
if (regno >= 0)
- store_register (regno);
+ store_register (regcache, regno);
else
{
for (r = 0; r < FP0_REGNUM; r++)
- store_register (r);
- i387_collect_fsave (current_regcache, -1, &npx);
+ store_register (regcache, r);
+ i387_collect_fsave (regcache, -1, &npx);
}
}
#endif
static void
-hppa_hpux_fetch_register (int regnum)
+hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
pid = ptid_get_pid (inferior_ptid);
/* This isn't really an address, but ptrace thinks of it as one. */
- addr = hppa_hpux_save_state_offset(current_regcache, regnum);
+ addr = hppa_hpux_save_state_offset (regcache, regnum);
size = register_size (current_gdbarch, regnum);
gdb_assert (size == 4 || size == 8);
store_unsigned_integer ((gdb_byte *)buf, 8, flags);
}
- regcache_raw_supply (current_regcache, regnum, buf);
+ regcache_raw_supply (regcache, regnum, buf);
}
static void
-hppa_hpux_fetch_inferior_registers (int regnum)
+hppa_hpux_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- hppa_hpux_fetch_register (regnum);
+ hppa_hpux_fetch_register (regcache, regnum);
else
- hppa_hpux_fetch_register (regnum);
+ hppa_hpux_fetch_register (regcache, regnum);
}
/* Store register REGNUM into the inferior. */
static void
-hppa_hpux_store_register (int regnum)
+hppa_hpux_store_register (struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
pid = ptid_get_pid (inferior_ptid);
/* This isn't really an address, but ptrace thinks of it as one. */
- addr = hppa_hpux_save_state_offset(current_regcache, regnum);
+ addr = hppa_hpux_save_state_offset (regcache, regnum);
size = register_size (current_gdbarch, regnum);
gdb_assert (size == 4 || size == 8);
buf = alloca (size);
- regcache_raw_collect (current_regcache, regnum, buf);
+ regcache_raw_collect (regcache, regnum, buf);
/* Take care with the "flags" register. It's stored as an `int' in
`struct save_state', even for 64-bit code. */
this for all registers (including the floating point registers). */
static void
-hppa_hpux_store_inferior_registers (int regnum)
+hppa_hpux_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- hppa_hpux_store_register (regnum);
+ hppa_hpux_store_register (regcache, regnum);
else
- hppa_hpux_store_register (regnum);
+ hppa_hpux_store_register (regcache, regnum);
}
static int
/* Fetch one register. */
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
int tid;
int val;
if (CANNOT_FETCH_REGISTER (regno))
{
- regcache_raw_supply (current_regcache, regno, NULL);
+ regcache_raw_supply (regcache, regno, NULL);
return;
}
error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno),
regno, safe_strerror (errno));
- regcache_raw_supply (current_regcache, regno, &val);
+ regcache_raw_supply (regcache, regno, &val);
}
/* Store one register. */
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
int tid;
int val;
tid = PIDGET (inferior_ptid); /* Not a threaded program. */
errno = 0;
- regcache_raw_collect (current_regcache, regno, &val);
+ regcache_raw_collect (regcache, regno, &val);
ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno),
point registers depending upon the value of regno. */
static void
-hppa_linux_fetch_inferior_registers (int regno)
+hppa_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
for (regno = 0; regno < NUM_REGS; regno++)
- fetch_register (regno);
+ fetch_register (regcache, regno);
}
else
{
- fetch_register (regno);
+ fetch_register (regcache, regno);
}
}
point registers depending upon the value of regno. */
static void
-hppa_linux_store_inferior_registers (int regno)
+hppa_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
for (regno = 0; regno < NUM_REGS; regno++)
- store_register (regno);
+ store_register (regcache, regno);
}
else
{
- store_register (regno);
+ store_register (regcache, regno);
}
}
for all registers (including the floating-point registers). */
static void
-hppabsd_fetch_registers (int regnum)
+hppabsd_fetch_registers (struct regcache *regcache, int regnum)
{
- struct regcache *regcache = current_regcache;
-
if (regnum == -1 || hppabsd_gregset_supplies_p (regnum))
{
struct reg regs;
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- hppabsd_supply_fpregset (current_regcache, &fpregs);
+ hppabsd_supply_fpregset (regcache, &fpregs);
}
}
this for all registers (including the floating-point registers). */
static void
-hppabsd_store_registers (int regnum)
+hppabsd_store_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || hppabsd_gregset_supplies_p (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- hppabsd_collect_gregset (current_regcache, ®s, regnum);
+ hppabsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- hppabsd_collect_fpregset (current_regcache, &fpregs, regnum);
+ hppabsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
};
static void
-hpux_thread_fetch_registers (int regno)
+hpux_thread_fetch_registers (struct regcache *regcache, int regno)
{
cma__t_int_tcb tcb, *tcb_ptr;
struct cleanup *old_chain;
if (tcb_ptr->state == cma__c_state_running)
{
- deprecated_child_ops.to_fetch_registers (regno);
+ deprecated_child_ops.to_fetch_registers (regcache, regno);
do_cleanups (old_chain);
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
- deprecated_child_ops.to_fetch_registers (regno);
+ deprecated_child_ops.to_fetch_registers (regcache, regno);
else
{
unsigned char buf[MAX_REGISTER_SIZE];
else
read_memory (sp + regmap[regno], buf, register_size (current_gdbarch, regno));
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
}
}
}
static void
-hpux_thread_store_registers (int regno)
+hpux_thread_store_registers (struct regcache *regcache, int regno)
{
cma__t_int_tcb tcb, *tcb_ptr;
struct cleanup *old_chain;
if (tcb_ptr->state == cma__c_state_running)
{
- deprecated_child_ops.to_store_registers (regno);
+ deprecated_child_ops.to_store_registers (regcache, regno);
do_cleanups (old_chain);
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
- deprecated_child_ops.to_store_registers (regno);
+ deprecated_child_ops.to_store_registers (regcache, regno);
else
{
unsigned char buf[MAX_REGISTER_SIZE];
sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;
if (regno == HPPA_FLAGS_REGNUM)
- deprecated_child_ops.to_store_registers (regno); /* Let lower layer handle this... */
+ deprecated_child_ops.to_store_registers (regcache, regno); /* Let lower layer handle this... */
else if (regno == HPPA_SP_REGNUM)
{
- regcache_raw_collect (current_regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
write_memory ((CORE_ADDR) &tcb_ptr->static_ctx.sp, buf,
register_size (current_gdbarch, regno));
tcb_ptr->static_ctx.sp
}
else if (regno == HPPA_PCOQ_HEAD_REGNUM)
{
- regcache_raw_collect (current_regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
write_memory (sp - 20, buf,
register_size (current_gdbarch, regno));
}
else
{
- regcache_raw_collect (current_regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
write_memory (sp + regmap[regno], buf,
register_size (current_gdbarch, regno));
}
/* Fetch one register. */
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
int tid;
int val;
gdb_assert (!have_ptrace_getregs);
if (regmap[regno] == -1)
{
- regcache_raw_supply (current_regcache, regno, NULL);
+ regcache_raw_supply (regcache, regno, NULL);
return;
}
error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno),
regno, safe_strerror (errno));
- regcache_raw_supply (current_regcache, regno, &val);
+ regcache_raw_supply (regcache, regno, &val);
}
/* Store one register. */
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
int tid;
int val;
tid = PIDGET (inferior_ptid); /* Not a threaded program. */
errno = 0;
- regcache_raw_collect (current_regcache, regno, &val);
+ regcache_raw_collect (regcache, regno, &val);
ptrace (PTRACE_POKEUSER, tid, 4 * regmap[regno], val);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno),
store their values in GDB's register array. */
static void
-fetch_regs (int tid)
+fetch_regs (struct regcache *regcache, int tid)
{
elf_gregset_t regs;
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
+ supply_gregset (regcache, (const elf_gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register array
into the process/thread specified by TID. */
static void
-store_regs (int tid, int regno)
+store_regs (const struct regcache *regcache, int tid, int regno)
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (current_regcache, ®s, regno);
+ fill_gregset (regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
#else
-static void fetch_regs (int tid) {}
-static void store_regs (int tid, int regno) {}
+static void fetch_regs (struct regcache *regcache, int tid) {}
+static void store_regs (const struct regcache *regcache, int tid, int regno) {}
#endif
\f
thier values in GDB's register array. */
static void
-fetch_fpregs (int tid)
+fetch_fpregs (struct regcache *regcache, int tid)
{
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregs);
+ supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register array
into the process/thread specified by TID. */
static void
-store_fpregs (int tid, int regno)
+store_fpregs (const struct regcache *regcache, int tid, int regno)
{
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (current_regcache, &fpregs, regno);
+ fill_fpregset (regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
#else
-static void fetch_fpregs (int tid) {}
-static void store_fpregs (int tid, int regno) {}
+static void fetch_fpregs (struct regcache *regcache, int tid) {}
+static void store_fpregs (const struct regcache *regcache, int tid, int regno) {}
#endif
\f
Return non-zero if successful, zero otherwise. */
static int
-fetch_fpxregs (int tid)
+fetch_fpxregs (struct regcache *regcache, int tid)
{
elf_fpxregset_t fpxregs;
perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
- supply_fpxregset (current_regcache, (const elf_fpxregset_t *) &fpxregs);
+ supply_fpxregset (regcache, (const elf_fpxregset_t *) &fpxregs);
return 1;
}
Return non-zero if successful, zero otherwise. */
static int
-store_fpxregs (int tid, int regno)
+store_fpxregs (const struct regcache *regcache, int tid, int regno)
{
elf_fpxregset_t fpxregs;
perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
- fill_fpxregset (current_regcache, &fpxregs, regno);
+ fill_fpxregset (regcache, &fpxregs, regno);
if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
perror_with_name (_("Couldn't write floating-point and SSE registers"));
#else
-static int fetch_fpxregs (int tid) { return 0; }
-static int store_fpxregs (int tid, int regno) { return 0; }
+static int fetch_fpxregs (struct regcache *regcache, int tid) { return 0; }
+static int store_fpxregs (const struct regcache *regcache, int tid, int regno) { return 0; }
#endif /* HAVE_PTRACE_GETFPXREGS */
\f
registers). */
static void
-i386_linux_fetch_inferior_registers (int regno)
+i386_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
for (i = 0; i < NUM_REGS; i++)
if (regno == -1 || regno == i)
- fetch_register (i);
+ fetch_register (regcache, i);
return;
}
zero. */
if (regno == -1)
{
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- i386_linux_fetch_inferior_registers (regno);
+ i386_linux_fetch_inferior_registers (regcache, regno);
return;
}
- if (fetch_fpxregs (tid))
+ if (fetch_fpxregs (regcache, tid))
return;
- fetch_fpregs (tid);
+ fetch_fpregs (regcache, tid);
return;
}
if (GETREGS_SUPPLIES (regno))
{
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
return;
}
if (GETFPXREGS_SUPPLIES (regno))
{
- if (fetch_fpxregs (tid))
+ if (fetch_fpxregs (regcache, tid))
return;
/* Either our processor or our kernel doesn't support the SSE
more graceful to handle differences in the register set using
gdbarch. Until then, this will at least make things work
plausibly. */
- fetch_fpregs (tid);
+ fetch_fpregs (regcache, tid);
return;
}
do this for all registers (including the floating point and SSE
registers). */
static void
-i386_linux_store_inferior_registers (int regno)
+i386_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
for (i = 0; i < NUM_REGS; i++)
if (regno == -1 || regno == i)
- store_register (i);
+ store_register (regcache, i);
return;
}
store_fpxregs can fail, and return zero. */
if (regno == -1)
{
- store_regs (tid, regno);
- if (store_fpxregs (tid, regno))
+ store_regs (regcache, tid, regno);
+ if (store_fpxregs (regcache, tid, regno))
return;
- store_fpregs (tid, regno);
+ store_fpregs (regcache, tid, regno);
return;
}
if (GETREGS_SUPPLIES (regno))
{
- store_regs (tid, regno);
+ store_regs (regcache, tid, regno);
return;
}
if (GETFPXREGS_SUPPLIES (regno))
{
- if (store_fpxregs (tid, regno))
+ if (store_fpxregs (regcache, tid, regno))
return;
/* Either our processor or our kernel doesn't support the SSE
registers, so just write the FP registers in the traditional
way. */
- store_fpregs (tid, regno);
+ store_fpregs (regcache, tid, regno);
return;
}
for all registers (including the floating point registers). */
static void
-i386bsd_fetch_inferior_registers (int regnum)
+i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- i386bsd_supply_gregset (current_regcache, ®s);
+ i386bsd_supply_gregset (regcache, ®s);
if (regnum != -1)
return;
}
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
{
have_ptrace_xmmregs = 1;
- i387_supply_fxsave (current_regcache, -1, xmmregs);
+ i387_supply_fxsave (regcache, -1, xmmregs);
}
else
{
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- i387_supply_fsave (current_regcache, -1, &fpregs);
+ i387_supply_fsave (regcache, -1, &fpregs);
}
#else
if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- i387_supply_fsave (current_regcache, -1, &fpregs);
+ i387_supply_fsave (regcache, -1, &fpregs);
#endif
}
}
this for all registers (including the floating point registers). */
static void
-i386bsd_store_inferior_registers (int regnum)
+i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- i386bsd_collect_gregset (current_regcache, ®s, regnum);
+ i386bsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
{
have_ptrace_xmmregs = 1;
- i387_collect_fxsave (current_regcache, regnum, xmmregs);
+ i387_collect_fxsave (regcache, regnum, xmmregs);
if (ptrace (PT_SETXMMREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- i387_collect_fsave (current_regcache, regnum, &fpregs);
+ i387_collect_fsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
of the corresponding (pseudo) registers. */
static void
-fetch_fpregs (struct proc *thread)
+fetch_fpregs (struct regcache *regcache, struct proc *thread)
{
mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
struct i386_float_state state;
if (!state.initialized)
{
/* The floating-point state isn't initialized. */
- i387_supply_fsave (current_regcache, -1, NULL);
+ i387_supply_fsave (regcache, -1, NULL);
}
else
{
/* Supply the floating-point registers. */
- i387_supply_fsave (current_regcache, -1, state.hw_state);
+ i387_supply_fsave (regcache, -1, state.hw_state);
}
}
/* Fetch register REGNO, or all regs if REGNO is -1. */
void
-gnu_fetch_registers (int regno)
+gnu_fetch_registers (struct regcache *regcache, int regno)
{
struct proc *thread;
proc_debug (thread, "fetching all register");
for (i = 0; i < I386_NUM_GREGS; i++)
- regcache_raw_supply (current_regcache, i, REG_ADDR (state, i));
+ regcache_raw_supply (regcache, i, REG_ADDR (state, i));
thread->fetched_regs = ~0;
}
else
{
proc_debug (thread, "fetching register %s", REGISTER_NAME (regno));
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
REG_ADDR (state, regno));
thread->fetched_regs |= (1 << regno);
}
{
proc_debug (thread, "fetching floating-point registers");
- fetch_fpregs (thread);
+ fetch_fpregs (regcache, thread);
}
}
\f
/* Store the whole floating-point state into THREAD using information
from the corresponding (pseudo) registers. */
static void
-store_fpregs (struct proc *thread, int regno)
+store_fpregs (const struct regcache *regcache, struct proc *thread, int regno)
{
mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT;
struct i386_float_state state;
/* FIXME: kettenis/2001-07-15: Is this right? Should we somehow
take into account DEPRECATED_REGISTER_VALID like the old code did? */
- i387_collect_fsave (current_regcache, regno, state.hw_state);
+ i387_collect_fsave (regcache, regno, state.hw_state);
err = thread_set_state (thread->port, i386_FLOAT_STATE,
(thread_state_t) &state, i386_FLOAT_STATE_COUNT);
/* Store at least register REGNO, or all regs if REGNO == -1. */
void
-gnu_store_registers (int regno)
+gnu_store_registers (struct regcache *regcache, int regno)
{
- struct regcache *regcache = current_regcache;
struct proc *thread;
/* Make sure we know about new threads. */
{
proc_debug (thread, "storing floating-point registers");
- store_fpregs (thread, regno);
+ store_fpregs (regcache, thread, regno);
}
}
/* Fetch register REGNUM from the inferior. */
static void
-ia64_linux_fetch_register (int regnum)
+ia64_linux_fetch_register (struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
if (ia64_cannot_fetch_register (regnum))
{
- regcache_raw_supply (current_regcache, regnum, NULL);
+ regcache_raw_supply (regcache, regnum, NULL);
return;
}
addr += sizeof (PTRACE_TYPE_RET);
}
- regcache_raw_supply (current_regcache, regnum, buf);
+ regcache_raw_supply (regcache, regnum, buf);
}
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
static void
-ia64_linux_fetch_registers (int regnum)
+ia64_linux_fetch_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- ia64_linux_fetch_register (regnum);
+ ia64_linux_fetch_register (regcache, regnum);
else
- ia64_linux_fetch_register (regnum);
+ ia64_linux_fetch_register (regcache, regnum);
}
/* Store register REGNUM into the inferior. */
static void
-ia64_linux_store_register (int regnum)
+ia64_linux_store_register (const struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
buf = alloca (size);
/* Write the register contents into the inferior a chunk at a time. */
- regcache_raw_collect (current_regcache, regnum, buf);
+ regcache_raw_collect (regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
this for all registers. */
static void
-ia64_linux_store_registers (int regnum)
+ia64_linux_store_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- ia64_linux_store_register (regnum);
+ ia64_linux_store_register (regcache, regnum);
else
- ia64_linux_store_register (regnum);
+ ia64_linux_store_register (regcache, regnum);
}
char to[MAX_REGISTER_SIZE];
convert_typed_floating (valbuf, type, to, builtin_type_ia64_ext);
regcache_cooked_write (regcache, IA64_FR8_REGNUM, (void *)to);
- target_store_registers (IA64_FR8_REGNUM);
+ target_store_registers (regcache, IA64_FR8_REGNUM);
}
else
regcache_cooked_write (regcache, IA64_GR8_REGNUM, valbuf);
for all registers. */
static void
-inf_child_fetch_inferior_registers (int regnum)
+inf_child_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
{
for (regnum = 0; regnum < NUM_REGS; regnum++)
- regcache_raw_supply (current_regcache, regnum, NULL);
+ regcache_raw_supply (regcache, regnum, NULL);
}
else
- regcache_raw_supply (current_regcache, regnum, NULL);
+ regcache_raw_supply (regcache, regnum, NULL);
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers (including the floating point registers). */
static void
-inf_child_store_inferior_registers (int regnum)
+inf_child_store_inferior_registers (struct regcache *regcache, int regnum)
{
}
/* Fetch register REGNUM from the inferior. */
static void
-inf_ptrace_fetch_register (int regnum)
+inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
if (CANNOT_FETCH_REGISTER (regnum))
{
- regcache_raw_supply (current_regcache, regnum, NULL);
+ regcache_raw_supply (regcache, regnum, NULL);
return;
}
addr += sizeof (PTRACE_TYPE_RET);
}
- regcache_raw_supply (current_regcache, regnum, buf);
+ regcache_raw_supply (regcache, regnum, buf);
}
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
static void
-inf_ptrace_fetch_registers (int regnum)
+inf_ptrace_fetch_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- inf_ptrace_fetch_register (regnum);
+ inf_ptrace_fetch_register (regcache, regnum);
else
- inf_ptrace_fetch_register (regnum);
+ inf_ptrace_fetch_register (regcache, regnum);
}
/* Store register REGNUM into the inferior. */
static void
-inf_ptrace_store_register (int regnum)
+inf_ptrace_store_register (const struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
buf = alloca (size);
/* Write the register contents into the inferior a chunk at a time. */
- regcache_raw_collect (current_regcache, regnum, buf);
+ regcache_raw_collect (regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
this for all registers. */
void
-inf_ptrace_store_registers (int regnum)
+inf_ptrace_store_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- inf_ptrace_store_register (regnum);
+ inf_ptrace_store_register (regcache, regnum);
else
- inf_ptrace_store_register (regnum);
+ inf_ptrace_store_register (regcache, regnum);
}
/* Create a "traditional" ptrace target. REGISTER_U_OFFSET should be
struct frame_info *frame,
int regnum, int all);
-extern void store_inferior_registers (int);
+extern void store_inferior_registers (struct regcache *, int);
-extern void fetch_inferior_registers (int);
+extern void fetch_inferior_registers (struct regcache *, int);
extern void child_terminal_info (char *, int);
/* Fetch register REGNUM from the inferior. */
static void
-fetch_register (int regnum)
+fetch_register (struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
if (CANNOT_FETCH_REGISTER (regnum))
{
- regcache_raw_supply (current_regcache, regnum, NULL);
+ regcache_raw_supply (regcache, regnum, NULL);
return;
}
addr += sizeof (PTRACE_TYPE_RET);
}
- regcache_raw_supply (current_regcache, regnum, buf);
+ regcache_raw_supply (regcache, regnum, buf);
}
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
void
-fetch_inferior_registers (int regnum)
+fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- fetch_register (regnum);
+ fetch_register (regcache, regnum);
else
- fetch_register (regnum);
+ fetch_register (regcache, regnum);
}
/* Store register REGNUM into the inferior. */
static void
-store_register (int regnum)
+store_register (const struct regcache *regcache, int regnum)
{
CORE_ADDR addr;
size_t size;
buf = alloca (size);
/* Write the register contents into the inferior a chunk at the time. */
- regcache_raw_collect (current_regcache, regnum, buf);
+ regcache_raw_collect (regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
this for all registers (including the floating point registers). */
void
-store_inferior_registers (int regnum)
+store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
for (regnum = 0; regnum < NUM_REGS; regnum++)
- store_register (regnum);
+ store_register (regcache, regnum);
else
- store_register (regnum);
+ store_register (regcache, regnum);
}
#endif /* not FETCH_INFERIOR_REGISTERS. */
inferior_ptid = ti->ptid;
registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
+ /* FIXME should not be necessary; fill_gregset should do it automatically. */
+ target_fetch_registers (current_regcache, -1);
args->note_data = linux_nat_do_thread_registers (args->obfd,
ti->ptid,
args->note_data,
args->num_notes++;
inferior_ptid = saved_ptid;
registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
+ /* FIXME should not be necessary; fill_gregset should do it automatically. */
+ target_fetch_registers (current_regcache, -1);
+
return 0;
}
char *note_data, int *note_size)
{
registers_changed ();
- target_fetch_registers (-1); /* FIXME should not be necessary;
- fill_gregset should do it automatically. */
+ /* FIXME should not be necessary; fill_gregset should do it automatically. */
+ target_fetch_registers (current_regcache, -1);
return linux_nat_do_thread_registers (obfd,
ptid_build (ptid_get_pid (inferior_ptid),
ptid_get_pid (inferior_ptid),
store their values in GDB's register array. */
static void
-fetch_regs (int tid)
+fetch_regs (struct regcache *regcache, int tid)
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
+ supply_gregset (regcache, (const elf_gregset_t *) ®s);
}
/* Fill register REGNO (if it is a general-purpose register) in
into the process/thread specified by TID. */
static void
-store_regs (int tid, int regno)
+store_regs (const struct regcache *regcache, int tid, int regno)
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (current_regcache, ®s, regno);
+ fill_gregset (regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
registers). */
static void
-m32r_linux_fetch_inferior_registers (int regno)
+m32r_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
results. */
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
return;
}
do this for all registers (including the floating point and SSE
registers). */
static void
-m32r_linux_store_inferior_registers (int regno)
+m32r_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
transfers more registers in one system call. */
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
- store_regs (tid, regno);
+ store_regs (regcache, tid, regno);
return;
}
for all registers (including the floating-point registers). */
static void
-m68kbsd_fetch_inferior_registers (int regnum)
+m68kbsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- m68kbsd_supply_gregset (current_regcache, ®s);
+ m68kbsd_supply_gregset (regcache, ®s);
}
if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum))
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- m68kbsd_supply_fpregset (current_regcache, &fpregs);
+ m68kbsd_supply_fpregset (regcache, &fpregs);
}
}
this for all registers (including the floating-point registers). */
static void
-m68kbsd_store_inferior_registers (int regnum)
+m68kbsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- m68kbsd_collect_gregset (current_regcache, ®s, regnum);
+ m68kbsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- m68kbsd_collect_fpregset (current_regcache, &fpregs, regnum);
+ m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
/* Fetch one register. */
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
if (CANNOT_FETCH_REGISTER (regno))
{
memset (buf, '\0', register_size (current_gdbarch, regno)); /* Supply zeroes */
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
return;
}
perror_with_name (mess);
}
}
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
}
/* Fetch register values from the inferior.
Otherwise, REGNO specifies which register (so we can save time). */
static void
-old_fetch_inferior_registers (int regno)
+old_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (regno >= 0)
{
- fetch_register (regno);
+ fetch_register (regcache, regno);
}
else
{
for (regno = 0; regno < NUM_REGS; regno++)
{
- fetch_register (regno);
+ fetch_register (regcache, regno);
}
}
}
/* Store one register. */
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
regaddr = 4 * regmap[regno];
/* Put the contents of regno into a local buffer */
- regcache_raw_collect (current_regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
/* Store the local buffer into the inferior a chunk at the time. */
for (i = 0; i < register_size (current_gdbarch, regno);
Otherwise, REGNO specifies which register (so we can save time). */
static void
-old_store_inferior_registers (int regno)
+old_store_inferior_registers (const struct regcache *regcache, int regno)
{
if (regno >= 0)
{
- store_register (regno);
+ store_register (regcache, regno);
}
else
{
for (regno = 0; regno < NUM_REGS; regno++)
{
- store_register (regno);
+ store_register (regcache, regno);
}
}
}
store their values in GDB's register array. */
static void
-fetch_regs (int tid)
+fetch_regs (struct regcache *regcache, int tid)
{
elf_gregset_t regs;
perror_with_name (_("Couldn't get registers"));
}
- supply_gregset (current_regcache, (const elf_gregset_t *) ®s);
+ supply_gregset (regcache, (const elf_gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register array
into the process/thread specified by TID. */
static void
-store_regs (int tid, int regno)
+store_regs (const struct regcache *regcache, int tid, int regno)
{
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (current_regcache, ®s, regno);
+ fill_gregset (regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
#else
-static void fetch_regs (int tid) {}
-static void store_regs (int tid, int regno) {}
+static void fetch_regs (struct regcache *regcache, int tid) {}
+static void store_regs (const struct regcache *regcache, int tid, int regno) {}
#endif
thier values in GDB's register array. */
static void
-fetch_fpregs (int tid)
+fetch_fpregs (struct regcache *regcache, int tid)
{
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (current_regcache, (const elf_fpregset_t *) &fpregs);
+ supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register array
into the process/thread specified by TID. */
static void
-store_fpregs (int tid, int regno)
+store_fpregs (const struct regcache *regcache, int tid, int regno)
{
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (current_regcache, &fpregs, regno);
+ fill_fpregset (regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
perror_with_name (_("Couldn't write floating point status"));
#else
-static void fetch_fpregs (int tid) {}
-static void store_fpregs (int tid, int regno) {}
+static void fetch_fpregs (struct regcache *regcache, int tid) {}
+static void store_fpregs (const struct regcache *regcache, int tid, int regno) {}
#endif
\f
registers). */
static void
-m68k_linux_fetch_inferior_registers (int regno)
+m68k_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
GETREGS request isn't available. */
if (! have_ptrace_getregs)
{
- old_fetch_inferior_registers (regno);
+ old_fetch_inferior_registers (regcache, regno);
return;
}
zero. */
if (regno == -1)
{
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
/* The call above might reset `have_ptrace_getregs'. */
if (! have_ptrace_getregs)
{
- old_fetch_inferior_registers (-1);
+ old_fetch_inferior_registers (regcache, -1);
return;
}
- fetch_fpregs (tid);
+ fetch_fpregs (regcache, tid);
return;
}
if (getregs_supplies (regno))
{
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
return;
}
if (getfpregs_supplies (regno))
{
- fetch_fpregs (tid);
+ fetch_fpregs (regcache, tid);
return;
}
do this for all registers (including the floating point and SSE
registers). */
static void
-m68k_linux_store_inferior_registers (int regno)
+m68k_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
int tid;
SETREGS request isn't available. */
if (! have_ptrace_getregs)
{
- old_store_inferior_registers (regno);
+ old_store_inferior_registers (regcache, regno);
return;
}
store_fpregs can fail, and return zero. */
if (regno == -1)
{
- store_regs (tid, regno);
- store_fpregs (tid, regno);
+ store_regs (regcache, tid, regno);
+ store_fpregs (regcache, tid, regno);
return;
}
if (getregs_supplies (regno))
{
- store_regs (tid, regno);
+ store_regs (regcache, tid, regno);
return;
}
if (getfpregs_supplies (regno))
{
- store_fpregs (tid, regno);
+ store_fpregs (regcache, tid, regno);
return;
}
for all registers. */
static void
-m88kbsd_fetch_inferior_registers (int regnum)
+m88kbsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- m88kbsd_supply_gregset (current_regcache, ®s);
+ m88kbsd_supply_gregset (regcache, ®s);
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers. */
static void
-m88kbsd_store_inferior_registers (int regnum)
+m88kbsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- m88kbsd_collect_gregset (current_regcache, ®s, regnum);
+ m88kbsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
/* Saved function pointers to fetch and store a single register using
PTRACE_PEEKUSER and PTRACE_POKEUSER. */
-void (*super_fetch_registers) (int);
-void (*super_store_registers) (int);
+void (*super_fetch_registers) (struct regcache *, int);
+void (*super_store_registers) (struct regcache *, int);
/* Pseudo registers can not be read. ptrace does not provide a way to
read (or set) MIPS_PS_REGNUM, and there's no point in reading or
using PTRACE_GETREGS et al. */
static void
-mips64_linux_regsets_fetch_registers (int regno)
+mips64_linux_regsets_fetch_registers (struct regcache *regcache, int regno)
{
int is_fp;
int tid;
perror_with_name (_("Couldn't get registers"));
}
- mips64_supply_gregset (current_regcache,
+ mips64_supply_gregset (regcache,
(const mips64_elf_gregset_t *) ®s);
}
perror_with_name (_("Couldn't get FP registers"));
}
- mips64_supply_fpregset (current_regcache,
+ mips64_supply_fpregset (regcache,
(const mips64_elf_fpregset_t *) &fp_regs);
}
}
using PTRACE_SETREGS et al. */
static void
-mips64_linux_regsets_store_registers (int regno)
+mips64_linux_regsets_store_registers (const struct regcache *regcache, int regno)
{
int is_fp;
int tid;
if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1)
perror_with_name (_("Couldn't get registers"));
- mips64_fill_gregset (current_regcache, ®s, regno);
+ mips64_fill_gregset (regcache, ®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1)
perror_with_name (_("Couldn't set registers"));
(PTRACE_TYPE_ARG3) &fp_regs) == -1)
perror_with_name (_("Couldn't get FP registers"));
- mips64_fill_fpregset (current_regcache, &fp_regs, regno);
+ mips64_fill_fpregset (regcache, &fp_regs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0L,
(PTRACE_TYPE_ARG3) &fp_regs) == -1)
using any working method. */
static void
-mips64_linux_fetch_registers (int regnum)
+mips64_linux_fetch_registers (struct regcache *regcache, int regnum)
{
/* Unless we already know that PTRACE_GETREGS does not work, try it. */
if (have_ptrace_regsets)
- mips64_linux_regsets_fetch_registers (regnum);
+ mips64_linux_regsets_fetch_registers (regcache, regnum);
/* If we know, or just found out, that PTRACE_GETREGS does not work, fall
back to PTRACE_PEEKUSER. */
if (!have_ptrace_regsets)
- super_fetch_registers (regnum);
+ super_fetch_registers (regcache, regnum);
}
/* Store REGNO (or all registers if REGNO == -1) to the target
using any working method. */
static void
-mips64_linux_store_registers (int regnum)
+mips64_linux_store_registers (struct regcache *regcache, int regnum)
{
/* Unless we already know that PTRACE_GETREGS does not work, try it. */
if (have_ptrace_regsets)
- mips64_linux_regsets_store_registers (regnum);
+ mips64_linux_regsets_store_registers (regcache, regnum);
/* If we know, or just found out, that PTRACE_GETREGS does not work, fall
back to PTRACE_PEEKUSER. */
if (!have_ptrace_regsets)
- super_store_registers (regnum);
+ super_store_registers (regcache, regnum);
}
/* Return the address in the core dump or inferior of register
for all registers. */
static void
-mips64obsd_fetch_inferior_registers (int regnum)
+mips64obsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- mips64obsd_supply_gregset (current_regcache, ®s);
+ mips64obsd_supply_gregset (regcache, ®s);
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers. */
static void
-mips64obsd_store_inferior_registers (int regnum)
+mips64obsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- mips64obsd_collect_gregset (current_regcache, ®s, regnum);
+ mips64obsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
}
static void
-mipsnbsd_fetch_inferior_registers (int regno)
+mipsnbsd_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- mipsnbsd_supply_reg (current_regcache, (char *) ®s, regno);
+ mipsnbsd_supply_reg (regcache, (char *) ®s, regno);
if (regno != -1)
return;
}
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- mipsnbsd_supply_fpreg (current_regcache, (char *) &fpregs, regno);
+ mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
}
}
static void
-mipsnbsd_store_inferior_registers (int regno)
+mipsnbsd_store_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- mipsnbsd_fill_reg (current_regcache, (char *) ®s, regno);
+ mipsnbsd_fill_reg (regcache, (char *) ®s, regno);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- mipsnbsd_fill_fpreg (current_regcache, (char *) &fpregs, regno);
+ mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
errno value. */
static void
-monitor_fetch_register (int regno)
+monitor_fetch_register (struct regcache *regcache, int regno)
{
const char *name;
char *zerobuf;
if (!name || (*name == '\0'))
{
monitor_debug ("No register known for %d\n", regno);
- regcache_raw_supply (current_regcache, regno, zerobuf);
+ regcache_raw_supply (regcache, regno, zerobuf);
return;
}
current_monitor->getreg.term_cmd) /* ack expected */
monitor_expect_prompt (NULL, 0); /* get response */
- monitor_supply_register (current_regcache, regno, regbuf);
+ monitor_supply_register (regcache, regno, regbuf);
}
/* Sometimes, it takes several commands to dump the registers */
}
static void
-monitor_fetch_registers (int regno)
+monitor_fetch_registers (struct regcache *regcache, int regno)
{
monitor_debug ("MON fetchregs\n");
if (current_monitor->getreg.cmd)
{
if (regno >= 0)
{
- monitor_fetch_register (regno);
+ monitor_fetch_register (regcache, regno);
return;
}
for (regno = 0; regno < NUM_REGS; regno++)
- monitor_fetch_register (regno);
+ monitor_fetch_register (regcache, regno);
}
else
{
- monitor_dump_regs (current_regcache);
+ monitor_dump_regs (regcache);
}
}
/* Store register REGNO, or all if REGNO == 0. Return errno value. */
static void
-monitor_store_register (int regno)
+monitor_store_register (struct regcache *regcache, int regno)
{
const char *name;
ULONGEST val;
return;
}
- val = read_register (regno);
+ regcache_cooked_read_unsigned (regcache, regno, &val);
monitor_debug ("MON storeg %d %s\n", regno,
phex (val, register_size (current_gdbarch, regno)));
/* Store the remote registers. */
static void
-monitor_store_registers (int regno)
+monitor_store_registers (struct regcache *regcache, int regno)
{
if (regno >= 0)
{
- monitor_store_register (regno);
+ monitor_store_register (regcache, regno);
return;
}
for (regno = 0; regno < NUM_REGS; regno++)
- monitor_store_register (regno);
+ monitor_store_register (regcache, regno);
}
/* Get ready to modify the registers array. On machines which store
struct mem_attrib *attrib,
struct target_ops *);
-static void procfs_fetch_registers (int);
+static void procfs_fetch_registers (struct regcache *, int);
static void notice_signals (void);
general register set and floating point registers (if supported)
and update gdb's idea of their current values. */
static void
-procfs_fetch_registers (int regno)
+procfs_fetch_registers (struct regcache *regcache, int regno)
{
union
{
procfs_set_thread (inferior_ptid);
if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK)
- nto_supply_gregset (current_regcache, (char *) ®.greg);
+ nto_supply_gregset (regcache, (char *) ®.greg);
if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size)
== EOK)
- nto_supply_fpregset (current_regcache, (char *) ®.fpreg);
+ nto_supply_fpregset (regcache, (char *) ®.fpreg);
if (devctl (ctl_fd, DCMD_PROC_GETALTREG, ®, sizeof (reg), ®size)
== EOK)
- nto_supply_altregset (current_regcache, (char *) ®.altreg);
+ nto_supply_altregset (regcache, (char *) ®.altreg);
}
/* Copy LEN bytes to/from inferior's memory starting at MEMADDR
}
void
-procfs_store_registers (int regno)
+procfs_store_registers (struct regcache *regcache, int regno)
{
union
{
if (dev_set == -1)
continue;
- if (nto_regset_fill (current_regcache, regset, (char *) ®) == -1)
+ if (nto_regset_fill (regcache, regset, (char *) ®) == -1)
continue;
err = devctl (ctl_fd, dev_set, ®, regsize, 0);
if (len < 1)
return;
- regcache_raw_collect (current_regcache, regno, (char *) ® + off);
+ regcache_raw_collect (regcache, regno, (char *) ® + off);
err = devctl (ctl_fd, dev_set, ®, regsize, 0);
if (err != EOK)
registers set mechanism, as opposed to the interface for all the
other registers, that stores/fetches each register individually. */
static void
-fetch_altivec_register (int tid, int regno)
+fetch_altivec_register (struct regcache *regcache, int tid, int regno)
{
int ret;
int offset = 0;
if (regno == (tdep->ppc_vrsave_regnum - 1))
offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
}
be the number of an upper half register, acc, spefscr, or -1 to
supply the values of all registers. */
static void
-fetch_spe_register (int tid, int regno)
+fetch_spe_register (struct regcache *regcache, int tid, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdb_evrregset_t evrregs;
int i;
for (i = 0; i < ppc_num_gprs; i++)
- regcache_raw_supply (current_regcache, tdep->ppc_ev0_upper_regnum + i,
+ regcache_raw_supply (regcache, tdep->ppc_ev0_upper_regnum + i,
&evrregs.evr[i]);
}
else if (tdep->ppc_ev0_upper_regnum <= regno
&& regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
- regcache_raw_supply (current_regcache, regno,
+ regcache_raw_supply (regcache, regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
if (regno == -1
|| regno == tdep->ppc_acc_regnum)
- regcache_raw_supply (current_regcache, tdep->ppc_acc_regnum, &evrregs.acc);
+ regcache_raw_supply (regcache, tdep->ppc_acc_regnum, &evrregs.acc);
if (regno == -1
|| regno == tdep->ppc_spefscr_regnum)
- regcache_raw_supply (current_regcache, tdep->ppc_spefscr_regnum,
+ regcache_raw_supply (regcache, tdep->ppc_spefscr_regnum,
&evrregs.spefscr);
}
static void
-fetch_register (int tid, int regno)
+fetch_register (struct regcache *regcache, int tid, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
register. */
if (have_ptrace_getvrregs)
{
- fetch_altivec_register (tid, regno);
+ fetch_altivec_register (regcache, tid, regno);
return;
}
/* If we have discovered that there is no ptrace support for
}
else if (spe_register_p (regno))
{
- fetch_spe_register (tid, regno);
+ fetch_spe_register (regcache, tid, regno);
return;
}
if (regaddr == -1)
{
memset (buf, '\0', register_size (current_gdbarch, regno)); /* Supply zeroes */
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
return;
}
{
/* Little-endian values are always found at the left end of the
bytes transferred. */
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
}
else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
{
transferred. */
size_t padding = (bytes_transferred
- register_size (current_gdbarch, regno));
- regcache_raw_supply (current_regcache, regno, buf + padding);
+ regcache_raw_supply (regcache, regno, buf + padding);
}
else
internal_error (__FILE__, __LINE__,
}
static void
-supply_vrregset (gdb_vrregset_t *vrregsetp)
+supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
occupies a whole vector, while VRSAVE occupies a full 4 bytes
slot. */
if (i == (num_of_vrregs - 2))
- regcache_raw_supply (current_regcache, tdep->ppc_vr0_regnum + i,
+ regcache_raw_supply (regcache, tdep->ppc_vr0_regnum + i,
*vrregsetp + i * vrregsize + offset);
else
- regcache_raw_supply (current_regcache, tdep->ppc_vr0_regnum + i,
+ regcache_raw_supply (regcache, tdep->ppc_vr0_regnum + i,
*vrregsetp + i * vrregsize);
}
}
static void
-fetch_altivec_registers (int tid)
+fetch_altivec_registers (struct regcache *regcache, int tid)
{
int ret;
gdb_vrregset_t regs;
}
perror_with_name (_("Unable to fetch AltiVec registers"));
}
- supply_vrregset (®s);
+ supply_vrregset (regcache, ®s);
}
static void
-fetch_ppc_registers (int tid)
+fetch_ppc_registers (struct regcache *regcache, int tid)
{
int i;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
- fetch_register (tid, tdep->ppc_gp0_regnum + i);
+ fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
- fetch_register (tid, tdep->ppc_fp0_regnum + i);
- fetch_register (tid, PC_REGNUM);
+ fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i);
+ fetch_register (regcache, tid, PC_REGNUM);
if (tdep->ppc_ps_regnum != -1)
- fetch_register (tid, tdep->ppc_ps_regnum);
+ fetch_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)
- fetch_register (tid, tdep->ppc_cr_regnum);
+ fetch_register (regcache, tid, tdep->ppc_cr_regnum);
if (tdep->ppc_lr_regnum != -1)
- fetch_register (tid, tdep->ppc_lr_regnum);
+ fetch_register (regcache, tid, tdep->ppc_lr_regnum);
if (tdep->ppc_ctr_regnum != -1)
- fetch_register (tid, tdep->ppc_ctr_regnum);
+ fetch_register (regcache, tid, tdep->ppc_ctr_regnum);
if (tdep->ppc_xer_regnum != -1)
- fetch_register (tid, tdep->ppc_xer_regnum);
+ fetch_register (regcache, tid, tdep->ppc_xer_regnum);
if (tdep->ppc_mq_regnum != -1)
- fetch_register (tid, tdep->ppc_mq_regnum);
+ fetch_register (regcache, tid, tdep->ppc_mq_regnum);
if (tdep->ppc_fpscr_regnum != -1)
- fetch_register (tid, tdep->ppc_fpscr_regnum);
+ fetch_register (regcache, tid, tdep->ppc_fpscr_regnum);
if (have_ptrace_getvrregs)
if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1)
- fetch_altivec_registers (tid);
+ fetch_altivec_registers (regcache, tid);
if (tdep->ppc_ev0_upper_regnum >= 0)
- fetch_spe_register (tid, -1);
+ fetch_spe_register (regcache, tid, -1);
}
/* Fetch registers from the child process. Fetch all registers if
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
static void
-ppc_linux_fetch_inferior_registers (int regno)
+ppc_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
tid = PIDGET (inferior_ptid);
if (regno == -1)
- fetch_ppc_registers (tid);
+ fetch_ppc_registers (regcache, tid);
else
- fetch_register (tid, regno);
+ fetch_register (regcache, tid, regno);
}
/* Store one register. */
static void
-store_altivec_register (int tid, int regno)
+store_altivec_register (const struct regcache *regcache, int tid, int regno)
{
int ret;
int offset = 0;
if (regno == (tdep->ppc_vrsave_regnum - 1))
offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
ret = ptrace (PTRACE_SETVRREGS, tid, 0, ®s);
If REGNO is -1, write the values of all the SPE-specific
registers. */
static void
-store_spe_register (int tid, int regno)
+store_spe_register (const struct regcache *regcache, int tid, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdb_evrregset_t evrregs;
int i;
for (i = 0; i < ppc_num_gprs; i++)
- regcache_raw_collect (current_regcache,
+ regcache_raw_collect (regcache,
tdep->ppc_ev0_upper_regnum + i,
&evrregs.evr[i]);
}
else if (tdep->ppc_ev0_upper_regnum <= regno
&& regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
- regcache_raw_collect (current_regcache, regno,
+ regcache_raw_collect (regcache, regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
if (regno == -1
|| regno == tdep->ppc_acc_regnum)
- regcache_raw_collect (current_regcache,
+ regcache_raw_collect (regcache,
tdep->ppc_acc_regnum,
&evrregs.acc);
if (regno == -1
|| regno == tdep->ppc_spefscr_regnum)
- regcache_raw_collect (current_regcache,
+ regcache_raw_collect (regcache,
tdep->ppc_spefscr_regnum,
&evrregs.spefscr);
}
static void
-store_register (int tid, int regno)
+store_register (const struct regcache *regcache, int tid, int regno)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
if (altivec_register_p (regno))
{
- store_altivec_register (tid, regno);
+ store_altivec_register (regcache, tid, regno);
return;
}
else if (spe_register_p (regno))
{
- store_spe_register (tid, regno);
+ store_spe_register (regcache, tid, regno);
return;
}
if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
{
/* Little-endian values always sit at the left end of the buffer. */
- regcache_raw_collect (current_regcache, regno, buf);
+ regcache_raw_collect (regcache, regno, buf);
}
else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
/* Big-endian values sit at the right end of the buffer. */
size_t padding = (bytes_to_transfer
- register_size (current_gdbarch, regno));
- regcache_raw_collect (current_regcache, regno, buf + padding);
+ regcache_raw_collect (regcache, regno, buf + padding);
}
for (i = 0; i < bytes_to_transfer; i += sizeof (long))
}
static void
-fill_vrregset (gdb_vrregset_t *vrregsetp)
+fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* The last 2 registers of this set are only 32 bit long, not
128, but only VSCR is fetched as a 16 bytes quantity. */
if (i == (num_of_vrregs - 2))
- regcache_raw_collect (current_regcache, tdep->ppc_vr0_regnum + i,
+ regcache_raw_collect (regcache, tdep->ppc_vr0_regnum + i,
*vrregsetp + i * vrregsize + offset);
else
- regcache_raw_collect (current_regcache, tdep->ppc_vr0_regnum + i,
+ regcache_raw_collect (regcache, tdep->ppc_vr0_regnum + i,
*vrregsetp + i * vrregsize);
}
}
static void
-store_altivec_registers (int tid)
+store_altivec_registers (const struct regcache *regcache, int tid)
{
int ret;
gdb_vrregset_t regs;
perror_with_name (_("Couldn't get AltiVec registers"));
}
- fill_vrregset (®s);
+ fill_vrregset (regcache, ®s);
if (ptrace (PTRACE_SETVRREGS, tid, 0, ®s) < 0)
perror_with_name (_("Couldn't write AltiVec registers"));
}
static void
-store_ppc_registers (int tid)
+store_ppc_registers (const struct regcache *regcache, int tid)
{
int i;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
- store_register (tid, tdep->ppc_gp0_regnum + i);
+ store_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
- store_register (tid, tdep->ppc_fp0_regnum + i);
- store_register (tid, PC_REGNUM);
+ store_register (regcache, tid, tdep->ppc_fp0_regnum + i);
+ store_register (regcache, tid, PC_REGNUM);
if (tdep->ppc_ps_regnum != -1)
- store_register (tid, tdep->ppc_ps_regnum);
+ store_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)
- store_register (tid, tdep->ppc_cr_regnum);
+ store_register (regcache, tid, tdep->ppc_cr_regnum);
if (tdep->ppc_lr_regnum != -1)
- store_register (tid, tdep->ppc_lr_regnum);
+ store_register (regcache, tid, tdep->ppc_lr_regnum);
if (tdep->ppc_ctr_regnum != -1)
- store_register (tid, tdep->ppc_ctr_regnum);
+ store_register (regcache, tid, tdep->ppc_ctr_regnum);
if (tdep->ppc_xer_regnum != -1)
- store_register (tid, tdep->ppc_xer_regnum);
+ store_register (regcache, tid, tdep->ppc_xer_regnum);
if (tdep->ppc_mq_regnum != -1)
- store_register (tid, tdep->ppc_mq_regnum);
+ store_register (regcache, tid, tdep->ppc_mq_regnum);
if (tdep->ppc_fpscr_regnum != -1)
- store_register (tid, tdep->ppc_fpscr_regnum);
+ store_register (regcache, tid, tdep->ppc_fpscr_regnum);
if (have_ptrace_getvrregs)
if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1)
- store_altivec_registers (tid);
+ store_altivec_registers (regcache, tid);
if (tdep->ppc_ev0_upper_regnum >= 0)
- store_spe_register (tid, -1);
+ store_spe_register (regcache, tid, -1);
}
static int
}
static void
-ppc_linux_store_inferior_registers (int regno)
+ppc_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
tid = PIDGET (inferior_ptid);
if (regno >= 0)
- store_register (tid, regno);
+ store_register (regcache, tid, regno);
else
- store_ppc_registers (tid);
+ store_ppc_registers (regcache, tid);
}
void
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);
+ right_fill_reg (regcache, tdep->ppc_ctr_regnum, regp + PT_CTR);
#ifdef PT_MQ
if (((regno == -1) || regno == tdep->ppc_mq_regnum)
&& (tdep->ppc_mq_regnum != -1))
fpp + 8 * regi);
}
if (regno == -1 || regno == tdep->ppc_fpscr_regnum)
- right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
+ right_fill_reg (regcache, tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
}
}
}
static void
-ppcnbsd_fetch_inferior_registers (int regnum)
+ppcnbsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || getregs_supplies (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- ppc_supply_gregset (&ppcnbsd_gregset, current_regcache,
+ ppc_supply_gregset (&ppcnbsd_gregset, regcache,
regnum, ®s, sizeof regs);
}
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
- ppc_supply_fpregset (&ppcnbsd_fpregset, current_regcache,
+ ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
regnum, &fpregs, sizeof fpregs);
}
}
static void
-ppcnbsd_store_inferior_registers (int regnum)
+ppcnbsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || getregs_supplies (regnum))
{
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- ppc_collect_gregset (&ppcnbsd_gregset, current_regcache,
+ ppc_collect_gregset (&ppcnbsd_gregset, regcache,
regnum, ®s, sizeof regs);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
- ppc_collect_fpregset (&ppcnbsd_fpregset, current_regcache,
+ ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
regnum, &fpregs, sizeof fpregs);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
for all registers. */
static void
-ppcobsd_fetch_registers (int regnum)
+ppcobsd_fetch_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- ppc_supply_gregset (&ppcobsd_gregset, current_regcache, -1,
+ ppc_supply_gregset (&ppcobsd_gregset, regcache, -1,
®s, sizeof regs);
#ifndef PT_GETFPREGS
- ppc_supply_fpregset (&ppcobsd_gregset, current_regcache, -1,
+ ppc_supply_fpregset (&ppcobsd_gregset, regcache, -1,
®s, sizeof regs);
#endif
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- ppc_supply_fpregset (&ppcobsd_fpregset, current_regcache, -1,
+ ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1,
&fpregs, sizeof fpregs);
}
#endif
this for all registers. */
static void
-ppcobsd_store_registers (int regnum)
+ppcobsd_store_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- ppc_collect_gregset (&ppcobsd_gregset, current_regcache,
+ ppc_collect_gregset (&ppcobsd_gregset, regcache,
regnum, ®s, sizeof regs);
#ifndef PT_GETFPREGS
- ppc_collect_fpregset (&ppcobsd_gregset, current_regcache,
+ ppc_collect_fpregset (&ppcobsd_gregset, regcache,
regnum, ®s, sizeof regs);
#endif
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
- ppc_collect_fpregset (&ppcobsd_fpregset, current_regcache,
+ ppc_collect_fpregset (&ppcobsd_fpregset, regcache,
regnum, &fpregs, sizeof fpregs);
if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
fill_gregset (current_regcache, (gdb_gregset_t *) gregset, -1);
do_cleanups (old_chain);
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
supply_gregset (current_regcache, (const gdb_gregset_t *) gregset);
- target_store_registers (-1);
+ target_store_registers (current_regcache, -1);
do_cleanups (old_chain);
return PS_OK;
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
- target_fetch_registers (-1);
+ target_fetch_registers (current_regcache, -1);
fill_fpregset (current_regcache, (gdb_fpregset_t *) fpregset, -1);
do_cleanups (old_chain);
inferior_ptid = BUILD_LWP (lwpid, ph->pid);
supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregset);
- target_store_registers (-1);
+ target_store_registers (current_regcache, -1);
do_cleanups (old_chain);
return PS_OK;
static int procfs_can_run (void);
static void procfs_stop (void);
static void procfs_files_info (struct target_ops *);
-static void procfs_fetch_registers (int);
-static void procfs_store_registers (int);
+static void procfs_fetch_registers (struct regcache *, int);
+static void procfs_store_registers (struct regcache *, int);
static void procfs_notice_signals (ptid_t);
static void procfs_prepare_to_store (void);
static void procfs_kill_inferior (void);
when the process is resumed. */
static void
-procfs_fetch_registers (int regnum)
+procfs_fetch_registers (struct regcache *regcache, int regnum)
{
gdb_gregset_t *gregs;
procinfo *pi;
if (gregs == NULL)
proc_error (pi, "fetch_registers, get_gregs", __LINE__);
- supply_gregset (current_regcache, (const gdb_gregset_t *) gregs);
+ supply_gregset (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 (current_regcache, (const gdb_fpregset_t *) fpregs);
+ supply_fpregset (regcache, (const gdb_fpregset_t *) fpregs);
}
}
writing one register might affect the value of others, etc. */
static void
-procfs_store_registers (int regnum)
+procfs_store_registers (struct regcache *regcache, int regnum)
{
gdb_gregset_t *gregs;
procinfo *pi;
if (gregs == NULL)
proc_error (pi, "store_registers, get_gregs", __LINE__);
- fill_gregset (current_regcache, gregs, regnum);
+ fill_gregset (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 (current_regcache, fpregs, regnum);
+ fill_fpregset (regcache, fpregs, regnum);
if (!proc_set_fpregs (pi))
proc_error (pi, "store_registers, set_fpregs", __LINE__);
}
registers_changed ();
registers_ptid = inferior_ptid;
}
- if (!register_cached (regnum))
- target_fetch_registers (regnum);
+ if (!regcache_valid_p (regcache, regnum))
+ target_fetch_registers (regcache, regnum);
#if 0
/* FIXME: cagney/2004-08-07: At present a number of targets
forget (or didn't know that they needed) to set this leading to
memcpy (register_buffer (regcache, regnum), buf,
regcache->descr->sizeof_register[regnum]);
regcache->register_valid_p[regnum] = 1;
- target_store_registers (regnum);
+ target_store_registers (regcache, regnum);
}
void
/* Read the remote registers into the block REGS. */
-static void m32r_fetch_register (int);
+static void m32r_fetch_register (struct regcache *, int);
static void
-m32r_fetch_registers (void)
+m32r_fetch_registers (struct regcache *regcache)
{
int regno;
for (regno = 0; regno < NUM_REGS; regno++)
- m32r_fetch_register (regno);
+ m32r_fetch_register (regcache, regno);
}
/* Fetch register REGNO, or all registers if REGNO is -1.
Returns errno value. */
static void
-m32r_fetch_register (int regno)
+m32r_fetch_register (struct regcache *regcache, int regno)
{
unsigned long val, val2, regid;
if (regno == -1)
- m32r_fetch_registers ();
+ m32r_fetch_registers (regcache);
else
{
char buffer[MAX_REGISTER_SIZE];
/* We got the number the register holds, but gdb expects to see a
value in the target byte ordering. */
store_unsigned_integer (buffer, 4, val);
- regcache_raw_supply (current_regcache, regno, buffer);
+ regcache_raw_supply (regcache, regno, buffer);
}
return;
}
/* Store the remote registers from the contents of the block REGS. */
-static void m32r_store_register (int);
+static void m32r_store_register (struct regcache *, int);
static void
-m32r_store_registers (void)
+m32r_store_registers (struct regcache *regcache)
{
int regno;
for (regno = 0; regno < NUM_REGS; regno++)
- m32r_store_register (regno);
+ m32r_store_register (regcache, regno);
registers_changed ();
}
/* Store register REGNO, or all if REGNO == 0.
Return errno value. */
static void
-m32r_store_register (int regno)
+m32r_store_register (struct regcache *regcache, int regno)
{
int regid;
ULONGEST regval, tmp;
if (regno == -1)
- m32r_store_registers ();
+ m32r_store_registers (regcache);
else
{
- regcache_cooked_read_unsigned (current_regcache, regno, ®val);
+ regcache_cooked_read_unsigned (regcache, regno, ®val);
regid = get_reg_id (regno);
if (regid == SDI_REG_PSW)
static int mips_map_regno (int regno);
-static void mips_fetch_registers (int regno);
+static void mips_fetch_registers (struct regcache *regcache, int regno);
static void mips_prepare_to_store (void);
-static void mips_store_registers (int regno);
+static void mips_store_registers (struct regcache *regcache, int regno);
static unsigned int mips_fetch_word (CORE_ADDR addr);
/* Fetch the remote registers. */
static void
-mips_fetch_registers (int regno)
+mips_fetch_registers (struct regcache *regcache, int regno)
{
unsigned LONGEST val;
int err;
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
- mips_fetch_registers (regno);
+ mips_fetch_registers (regcache, regno);
return;
}
/* We got the number the register holds, but gdb expects to see a
value in the target byte ordering. */
store_unsigned_integer (buf, register_size (current_gdbarch, regno), val);
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
}
}
/* Store remote register(s). */
static void
-mips_store_registers (int regno)
+mips_store_registers (struct regcache *regcache, int regno)
{
+ ULONGEST val;
int err;
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
- mips_store_registers (regno);
+ mips_store_registers (regcache, regno);
return;
}
- mips_request ('R', mips_map_regno (regno),
- read_register (regno),
+ regcache_cooked_read_unsigned (regcache, regno, &val);
+ mips_request ('R', mips_map_regno (regno), val,
&err, mips_receive_wait, NULL);
if (err)
mips_error ("Can't write register %d: %s", regno, safe_strerror (errno));
static void gdb_os_error (host_callback *, const char *, ...);
-static void gdbsim_fetch_register (int regno);
+static void gdbsim_fetch_register (struct regcache *regcache, int regno);
-static void gdbsim_store_register (int regno);
+static void gdbsim_store_register (struct regcache *regcache, int regno);
static void gdbsim_kill (void);
}
static void
-gdbsim_fetch_register (int regno)
+gdbsim_fetch_register (struct regcache *regcache, int regno)
{
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
- gdbsim_fetch_register (regno);
+ gdbsim_fetch_register (regcache, regno);
return;
}
char buf[MAX_REGISTER_SIZE];
int nr_bytes;
memset (buf, 0, MAX_REGISTER_SIZE);
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
set_register_cached (regno, -1);
break;
}
+
default:
{
static int warn_user = 1;
which registers are fetchable. */
/* Else if (nr_bytes < 0): an old simulator, that doesn't
think to return the register size. Just assume all is ok. */
- regcache_raw_supply (current_regcache, regno, buf);
+ regcache_raw_supply (regcache, regno, buf);
if (remote_debug)
{
printf_filtered ("gdbsim_fetch_register: %d", regno);
static void
-gdbsim_store_register (int regno)
+gdbsim_store_register (struct regcache *regcache, int regno)
{
if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
- gdbsim_store_register (regno);
+ gdbsim_store_register (regcache, regno);
return;
}
else if (REGISTER_SIM_REGNO (regno) >= 0)
{
char tmp[MAX_REGISTER_SIZE];
int nr_bytes;
- regcache_cooked_read (current_regcache, regno, tmp);
+ regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc,
REGISTER_SIM_REGNO (regno),
tmp, register_size (current_gdbarch, regno));
static void remote_prepare_to_store (void);
-static void remote_fetch_registers (int regno);
+static void remote_fetch_registers (struct regcache *regcache, int regno);
static void remote_resume (ptid_t ptid, int step,
enum target_signal siggnal);
static void remote_close (int quitting);
-static void remote_store_registers (int regno);
+static void remote_store_registers (struct regcache *regcache, int regno);
static void remote_mourn (void);
static void remote_async_mourn (void);
/* Fetch a single register using a 'p' packet. */
static int
-fetch_register_using_p (struct packet_reg *reg)
+fetch_register_using_p (struct regcache *regcache, struct packet_reg *reg)
{
struct remote_state *rs = get_remote_state ();
char *buf, *p;
/* If this register is unfetchable, tell the regcache. */
if (buf[0] == 'x')
{
- regcache_raw_supply (current_regcache, reg->regnum, NULL);
+ regcache_raw_supply (regcache, reg->regnum, NULL);
set_register_cached (reg->regnum, -1);
return 1;
}
regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
p += 2;
}
- regcache_raw_supply (current_regcache, reg->regnum, regp);
+ regcache_raw_supply (regcache, reg->regnum, regp);
return 1;
}
}
static void
-process_g_packet (void)
+process_g_packet (struct regcache *regcache)
{
struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
gdb_assert (r->offset * 2 < strlen (rs->buf));
/* The register isn't available, mark it as such (at
the same time setting the value to zero). */
- regcache_raw_supply (current_regcache, r->regnum, NULL);
+ regcache_raw_supply (regcache, r->regnum, NULL);
set_register_cached (i, -1);
}
else
- regcache_raw_supply (current_regcache, r->regnum,
+ regcache_raw_supply (regcache, r->regnum,
regs + r->offset);
}
}
}
static void
-fetch_registers_using_g (void)
+fetch_registers_using_g (struct regcache *regcache)
{
send_g_packet ();
- process_g_packet ();
+ process_g_packet (regcache);
}
static void
-remote_fetch_registers (int regnum)
+remote_fetch_registers (struct regcache *regcache, int regnum)
{
struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
contents, so fall back to 'p'. */
if (reg->in_g_packet)
{
- fetch_registers_using_g ();
+ fetch_registers_using_g (regcache);
if (reg->in_g_packet)
return;
}
- if (fetch_register_using_p (reg))
+ if (fetch_register_using_p (regcache, reg))
return;
/* This register is not available. */
- regcache_raw_supply (current_regcache, reg->regnum, NULL);
+ regcache_raw_supply (regcache, reg->regnum, NULL);
set_register_cached (reg->regnum, -1);
return;
}
- fetch_registers_using_g ();
+ fetch_registers_using_g (regcache);
for (i = 0; i < NUM_REGS; i++)
if (!rsa->regs[i].in_g_packet)
- if (!fetch_register_using_p (&rsa->regs[i]))
+ if (!fetch_register_using_p (regcache, &rsa->regs[i]))
{
/* This register is not available. */
- regcache_raw_supply (current_regcache, i, NULL);
+ regcache_raw_supply (regcache, i, NULL);
set_register_cached (i, -1);
}
}
packet was not recognized. */
static int
-store_register_using_P (struct packet_reg *reg)
+store_register_using_P (const struct regcache *regcache, struct packet_reg *reg)
{
struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
xsnprintf (buf, get_remote_packet_size (), "P%s=", phex_nz (reg->pnum, 0));
p = buf + strlen (buf);
- regcache_raw_collect (current_regcache, reg->regnum, regp);
+ regcache_raw_collect (regcache, reg->regnum, regp);
bin2hex (regp, p, register_size (current_gdbarch, reg->regnum));
remote_send (&rs->buf, &rs->buf_size);
contents of the register cache buffer. FIXME: ignores errors. */
static void
-store_registers_using_G (void)
+store_registers_using_G (const struct regcache *regcache)
{
struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
{
struct packet_reg *r = &rsa->regs[i];
if (r->in_g_packet)
- regcache_raw_collect (current_regcache, r->regnum, regs + r->offset);
+ regcache_raw_collect (regcache, r->regnum, regs + r->offset);
}
}
of the register cache buffer. FIXME: ignores errors. */
static void
-remote_store_registers (int regnum)
+remote_store_registers (struct regcache *regcache, int regnum)
{
struct remote_state *rs = get_remote_state ();
struct remote_arch_state *rsa = get_remote_arch_state ();
possible; we often change only a small number of registers.
Sometimes we change a larger number; we'd need help from a
higher layer to know to use 'G'. */
- if (store_register_using_P (reg))
+ if (store_register_using_P (regcache, reg))
return;
/* For now, don't complain if we have no way to write the
if (!reg->in_g_packet)
return;
- store_registers_using_G ();
+ store_registers_using_G (regcache);
return;
}
- store_registers_using_G ();
+ store_registers_using_G (regcache);
for (i = 0; i < NUM_REGS; i++)
if (!rsa->regs[i].in_g_packet)
- if (!store_register_using_P (&rsa->regs[i]))
+ if (!store_register_using_P (regcache, &rsa->regs[i]))
/* See above for why we do not issue an error here. */
continue;
}
/* Fetch register REGNO from the inferior. */
static void
-fetch_register (int regno)
+fetch_register (struct regcache *regcache, int regno)
{
int addr[MAX_REGISTER_SIZE];
int nr, isfloat;
}
if (!errno)
- regcache_raw_supply (current_regcache, regno, (char *) addr);
+ regcache_raw_supply (regcache, regno, (char *) addr);
else
{
#if 0
/* Store register REGNO back into the inferior. */
static void
-store_register (int regno)
+store_register (const struct regcache *regcache, int regno)
{
int addr[MAX_REGISTER_SIZE];
int nr, isfloat;
/* Fetch the register's value from the register cache. */
- regcache_raw_collect (current_regcache, regno, addr);
+ regcache_raw_collect (regcache, regno, addr);
/* -1 can be a successful return value, so infer errors from errno. */
errno = 0;
REGNO otherwise. */
static void
-rs6000_fetch_inferior_registers (int regno)
+rs6000_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (regno != -1)
- fetch_register (regno);
+ fetch_register (regcache, regno);
else
{
regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
regno++)
{
- fetch_register (regno);
+ fetch_register (regcache, regno);
}
/* Read general purpose floating point registers. */
if (tdep->ppc_fp0_regnum >= 0)
for (regno = 0; regno < ppc_num_fprs; regno++)
- fetch_register (tdep->ppc_fp0_regnum + regno);
+ fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Read special registers. */
- fetch_register (PC_REGNUM);
- fetch_register (tdep->ppc_ps_regnum);
- fetch_register (tdep->ppc_cr_regnum);
- fetch_register (tdep->ppc_lr_regnum);
- fetch_register (tdep->ppc_ctr_regnum);
- fetch_register (tdep->ppc_xer_regnum);
+ fetch_register (regcache, PC_REGNUM);
+ fetch_register (regcache, tdep->ppc_ps_regnum);
+ fetch_register (regcache, tdep->ppc_cr_regnum);
+ fetch_register (regcache, tdep->ppc_lr_regnum);
+ fetch_register (regcache, tdep->ppc_ctr_regnum);
+ fetch_register (regcache, tdep->ppc_xer_regnum);
if (tdep->ppc_fpscr_regnum >= 0)
- fetch_register (tdep->ppc_fpscr_regnum);
+ fetch_register (regcache, tdep->ppc_fpscr_regnum);
if (tdep->ppc_mq_regnum >= 0)
- fetch_register (tdep->ppc_mq_regnum);
+ fetch_register (regcache, tdep->ppc_mq_regnum);
}
}
Otherwise, REGNO specifies which register (so we can save time). */
static void
-rs6000_store_inferior_registers (int regno)
+rs6000_store_inferior_registers (struct regcache *regcache, int regno)
{
if (regno != -1)
- store_register (regno);
+ store_register (regcache, regno);
else
{
regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
regno++)
{
- store_register (regno);
+ store_register (regcache, regno);
}
/* Write floating point registers. */
if (tdep->ppc_fp0_regnum >= 0)
for (regno = 0; regno < ppc_num_fprs; regno++)
- store_register (tdep->ppc_fp0_regnum + regno);
+ store_register (regcache, tdep->ppc_fp0_regnum + regno);
/* Write special registers. */
- store_register (PC_REGNUM);
- store_register (tdep->ppc_ps_regnum);
- store_register (tdep->ppc_cr_regnum);
- store_register (tdep->ppc_lr_regnum);
- store_register (tdep->ppc_ctr_regnum);
- store_register (tdep->ppc_xer_regnum);
+ store_register (regcache, PC_REGNUM);
+ store_register (regcache, tdep->ppc_ps_regnum);
+ store_register (regcache, tdep->ppc_cr_regnum);
+ store_register (regcache, tdep->ppc_lr_regnum);
+ store_register (regcache, tdep->ppc_ctr_regnum);
+ store_register (regcache, tdep->ppc_xer_regnum);
if (tdep->ppc_fpscr_regnum >= 0)
- store_register (tdep->ppc_fpscr_regnum);
+ store_register (regcache, tdep->ppc_fpscr_regnum);
if (tdep->ppc_mq_regnum >= 0)
- store_register (tdep->ppc_mq_regnum);
+ store_register (regcache, tdep->ppc_mq_regnum);
}
}
regcache_raw_write_signed (regcache, tdep->ppc_toc_regnum, tocvalue);
}
- target_store_registers (-1);
+ target_store_registers (regcache, -1);
return sp;
}
/* Fetch all general-purpose registers from process/thread TID and
store their values in GDB's register cache. */
static void
-fetch_regs (int tid)
+fetch_regs (struct regcache *regcache, int tid)
{
gregset_t regs;
ptrace_area parea;
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- supply_gregset (current_regcache, (const gregset_t *) ®s);
+ supply_gregset (regcache, (const gregset_t *) ®s);
}
/* Store all valid general-purpose registers in GDB's register cache
into the process/thread specified by TID. */
static void
-store_regs (int tid, int regnum)
+store_regs (const struct regcache *regcache, int tid, int regnum)
{
gregset_t regs;
ptrace_area parea;
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get registers"));
- fill_gregset (current_regcache, ®s, regnum);
+ fill_gregset (regcache, ®s, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't write registers"));
/* Fetch all floating-point registers from process/thread TID and store
their values in GDB's register cache. */
static void
-fetch_fpregs (int tid)
+fetch_fpregs (struct regcache *regcache, int tid)
{
fpregset_t fpregs;
ptrace_area parea;
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get floating point status"));
- supply_fpregset (current_regcache, (const fpregset_t *) &fpregs);
+ supply_fpregset (regcache, (const fpregset_t *) &fpregs);
}
/* Store all valid floating-point registers in GDB's register cache
into the process/thread specified by TID. */
static void
-store_fpregs (int tid, int regnum)
+store_fpregs (const struct regcache *regcache, int tid, int regnum)
{
fpregset_t fpregs;
ptrace_area parea;
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't get floating point status"));
- fill_fpregset (current_regcache, &fpregs, regnum);
+ fill_fpregset (regcache, &fpregs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
perror_with_name (_("Couldn't write floating point status"));
/* Fetch register REGNUM from the child process. If REGNUM is -1, do
this for all registers. */
static void
-s390_linux_fetch_inferior_registers (int regnum)
+s390_linux_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
int tid = s390_inferior_tid ();
if (regnum == -1
|| (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1))
- fetch_regs (tid);
+ fetch_regs (regcache, tid);
if (regnum == -1
|| (regnum < S390_NUM_REGS && regmap_fpregset[regnum] != -1))
- fetch_fpregs (tid);
+ fetch_fpregs (regcache, tid);
}
/* Store register REGNUM back into the child process. If REGNUM is
-1, do this for all registers. */
static void
-s390_linux_store_inferior_registers (int regnum)
+s390_linux_store_inferior_registers (struct regcache *regcache, int regnum)
{
int tid = s390_inferior_tid ();
if (regnum == -1
|| (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1))
- store_regs (tid, regnum);
+ store_regs (regcache, tid, regnum);
if (regnum == -1
|| (regnum < S390_NUM_REGS && regmap_fpregset[regnum] != -1))
- store_fpregs (tid, regnum);
+ store_fpregs (regcache, tid, regnum);
}
|| (regno) == SR_REGNUM)
static void
-shnbsd_fetch_inferior_registers (int regno)
+shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- shnbsd_supply_reg (current_regcache, (char *) &inferior_registers, regno);
+ shnbsd_supply_reg (regcache, (char *) &inferior_registers, regno);
if (regno != -1)
return;
}
static void
-shnbsd_store_inferior_registers (int regno)
+shnbsd_store_inferior_registers (struct regcache *regcache, int regno)
{
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- shnbsd_fill_reg (current_regcache, (char *) &inferior_registers, regno);
+ shnbsd_fill_reg (regcache, (char *) &inferior_registers, regno);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
}
static void
-sol_thread_fetch_registers (int regnum)
+sol_thread_fetch_registers (struct regcache *regcache, int regnum)
{
thread_t thread;
td_thrhandle_t thandle;
{
/* It's an LWP; pass the request on to procfs. */
if (target_has_execution)
- procfs_ops.to_fetch_registers (regnum);
+ procfs_ops.to_fetch_registers (regcache, regnum);
else
- orig_core_ops.to_fetch_registers (regnum);
+ orig_core_ops.to_fetch_registers (regcache, regnum);
return;
}
calling the td routines because the td routines call ps_lget*
which affect the values stored in the registers array. */
- supply_gregset (current_regcache, (const gdb_gregset_t *) &gregset);
- supply_fpregset (current_regcache, (const gdb_fpregset_t *) &fpregset);
+ supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
+ supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregset);
#if 0
/* FIXME: libthread_db doesn't seem to handle this right. */
}
static void
-sol_thread_store_registers (int regnum)
+sol_thread_store_registers (struct regcache *regcache, int regnum)
{
thread_t thread;
td_thrhandle_t thandle;
if (!is_thread (inferior_ptid))
{
/* It's an LWP; pass the request on to procfs.c. */
- procfs_ops.to_store_registers (regnum);
+ procfs_ops.to_store_registers (regcache, regnum);
return;
}
char old_value[MAX_REGISTER_SIZE];
/* Save new register value. */
- regcache_raw_collect (current_regcache, regnum, old_value);
+ regcache_raw_collect (regcache, regnum, old_value);
val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK)
td_err_string (val));
/* Restore new register value. */
- regcache_raw_supply (current_regcache, regnum, old_value);
+ regcache_raw_supply (regcache, regnum, old_value);
#if 0
/* FIXME: libthread_db doesn't seem to handle this right. */
#endif
}
- fill_gregset (current_regcache, (gdb_gregset_t *) &gregset, regnum);
- fill_fpregset (current_regcache, (gdb_fpregset_t *) &fpregset, regnum);
+ fill_gregset (regcache, (gdb_gregset_t *) &gregset, regnum);
+ fill_fpregset (regcache, (gdb_fpregset_t *) &fpregset, regnum);
val = p_td_thr_setgregs (&thandle, gregset);
if (val != TD_OK)
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
if (target_has_execution)
- procfs_ops.to_fetch_registers (-1);
+ procfs_ops.to_fetch_registers (current_regcache, -1);
else
- orig_core_ops.to_fetch_registers (-1);
+ orig_core_ops.to_fetch_registers (current_regcache, -1);
fill_gregset (current_regcache, (gdb_gregset_t *) gregset, -1);
do_cleanups (old_chain);
supply_gregset (current_regcache, (const gdb_gregset_t *) gregset);
if (target_has_execution)
- procfs_ops.to_store_registers (-1);
+ procfs_ops.to_store_registers (current_regcache, -1);
else
- orig_core_ops.to_store_registers (-1);
+ orig_core_ops.to_store_registers (current_regcache, -1);
do_cleanups (old_chain);
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
if (target_has_execution)
- procfs_ops.to_fetch_registers (-1);
+ procfs_ops.to_fetch_registers (current_regcache, -1);
else
- orig_core_ops.to_fetch_registers (-1);
+ orig_core_ops.to_fetch_registers (current_regcache, -1);
fill_fpregset (current_regcache, (gdb_fpregset_t *) fpregset, -1);
do_cleanups (old_chain);
supply_fpregset (current_regcache, (const gdb_fpregset_t *) fpregset);
if (target_has_execution)
- procfs_ops.to_store_registers (-1);
+ procfs_ops.to_store_registers (current_regcache, -1);
else
- orig_core_ops.to_store_registers (-1);
+ orig_core_ops.to_store_registers (current_regcache, -1);
do_cleanups (old_chain);
for all registers (including the floating-point registers). */
void
-fetch_inferior_registers (int regnum)
+fetch_inferior_registers (struct regcache *regcache, int regnum)
{
- struct regcache *regcache = current_regcache;
int pid;
/* NOTE: cagney/2002-12-03: This code assumes that the currently
}
void
-store_inferior_registers (int regnum)
+store_inferior_registers (struct regcache *regcache, int regnum)
{
- struct regcache *regcache = current_regcache;
int pid;
/* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
/* Override the fetch_inferior_register routine. */
static void
-spu_fetch_inferior_registers (int regno)
+spu_fetch_inferior_registers (struct regcache *regcache, int regno)
{
int fd;
CORE_ADDR addr;
{
char buf[4];
store_unsigned_integer (buf, 4, fd);
- regcache_raw_supply (current_regcache, SPU_ID_REGNUM, buf);
+ regcache_raw_supply (regcache, SPU_ID_REGNUM, buf);
}
/* The NPC register is found at ADDR. */
{
gdb_byte buf[4];
if (fetch_ppc_memory (addr, buf, 4) == 0)
- regcache_raw_supply (current_regcache, SPU_PC_REGNUM, buf);
+ regcache_raw_supply (regcache, SPU_PC_REGNUM, buf);
}
/* The GPRs are found in the "regs" spufs file. */
xsnprintf (annex, sizeof annex, "%d/regs", fd);
if (spu_proc_xfer_spu (annex, buf, NULL, 0, sizeof buf) == sizeof buf)
for (i = 0; i < SPU_NUM_GPRS; i++)
- regcache_raw_supply (current_regcache, i, buf + i*16);
+ regcache_raw_supply (regcache, i, buf + i*16);
}
}
/* Override the store_inferior_register routine. */
static void
-spu_store_inferior_registers (int regno)
+spu_store_inferior_registers (struct regcache *regcache, int regno)
{
int fd;
CORE_ADDR addr;
if (regno == -1 || regno == SPU_PC_REGNUM)
{
gdb_byte buf[4];
- regcache_raw_collect (current_regcache, SPU_PC_REGNUM, buf);
+ regcache_raw_collect (regcache, SPU_PC_REGNUM, buf);
store_ppc_memory (addr, buf, 4);
}
int i;
for (i = 0; i < SPU_NUM_GPRS; i++)
- regcache_raw_collect (current_regcache, i, buf + i*16);
+ regcache_raw_collect (regcache, i, buf + i*16);
xsnprintf (annex, sizeof annex, "%d/regs", fd);
spu_proc_xfer_spu (annex, NULL, buf, 0, sizeof buf);
static ptid_t debug_to_wait (ptid_t, struct target_waitstatus *);
-static void debug_to_fetch_registers (int);
+static void debug_to_fetch_registers (struct regcache *, int);
-static void debug_to_store_registers (int);
+static void debug_to_store_registers (struct regcache *, int);
static void debug_to_prepare_to_store (void);
(ptid_t (*) (ptid_t, struct target_waitstatus *))
noprocess);
de_fault (to_fetch_registers,
- (void (*) (int))
+ (void (*) (struct regcache *, int))
target_ignore);
de_fault (to_store_registers,
- (void (*) (int))
+ (void (*) (struct regcache *, int))
noprocess);
de_fault (to_prepare_to_store,
(void (*) (void))
}
static void
-debug_print_register (const char * func, int regno)
+debug_print_register (const char * func,
+ struct regcache *regcache, int regno)
{
fprintf_unfiltered (gdb_stdlog, "%s ", func);
if (regno >= 0 && regno < NUM_REGS + NUM_PSEUDO_REGS
{
int i, size = register_size (current_gdbarch, regno);
unsigned char buf[MAX_REGISTER_SIZE];
- regcache_cooked_read (current_regcache, regno, buf);
+ regcache_cooked_read (regcache, regno, buf);
fprintf_unfiltered (gdb_stdlog, " = ");
for (i = 0; i < size; i++)
{
}
static void
-debug_to_fetch_registers (int regno)
+debug_to_fetch_registers (struct regcache *regcache, int regno)
{
- debug_target.to_fetch_registers (regno);
- debug_print_register ("target_fetch_registers", regno);
+ debug_target.to_fetch_registers (regcache, regno);
+ debug_print_register ("target_fetch_registers", regcache, regno);
}
static void
-debug_to_store_registers (int regno)
+debug_to_store_registers (struct regcache *regcache, int regno)
{
- debug_target.to_store_registers (regno);
- debug_print_register ("target_store_registers", regno);
+ debug_target.to_store_registers (regcache, regno);
+ debug_print_register ("target_store_registers", regcache, regno);
fprintf_unfiltered (gdb_stdlog, "\n");
}
struct mem_attrib;
struct target_ops;
struct bp_target_info;
+struct regcache;
/* This include file defines the interface between the main part
of the debugger, and the part which is target-specific, or
void (*to_disconnect) (struct target_ops *, char *, int);
void (*to_resume) (ptid_t, int, enum target_signal);
ptid_t (*to_wait) (ptid_t, struct target_waitstatus *);
- void (*to_fetch_registers) (int);
- void (*to_store_registers) (int);
+ void (*to_fetch_registers) (struct regcache *, int);
+ void (*to_store_registers) (struct regcache *, int);
void (*to_prepare_to_store) (void);
/* Transfer LEN bytes of memory between GDB address MYADDR and
/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
-#define target_fetch_registers(regno) \
- (*current_target.to_fetch_registers) (regno)
+#define target_fetch_registers(regcache, regno) \
+ (*current_target.to_fetch_registers) (regcache, regno)
/* Store at least register REGNO, or all regs if REGNO == -1.
It can store as many registers as it wants to, so target_prepare_to_store
must have been previously called. Calls error() if there are problems. */
-#define target_store_registers(regs) \
- (*current_target.to_store_registers) (regs)
+#define target_store_registers(regcache, regs) \
+ (*current_target.to_store_registers) (regcache, regs)
/* Get ready to modify the registers array. On machines which store
individual registers, this doesn't need to do anything. On machines
for all registers. */
static void
-vaxbsd_fetch_inferior_registers (int regnum)
+vaxbsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- vaxbsd_supply_gregset (current_regcache, ®s);
+ vaxbsd_supply_gregset (regcache, ®s);
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
this for all registers. */
static void
-vaxbsd_store_inferior_registers (int regnum)
+vaxbsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
- vaxbsd_collect_gregset (current_regcache, ®s, regnum);
+ vaxbsd_collect_gregset (regcache, ®s, regnum);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
}
static void
-do_win32_fetch_inferior_registers (int r)
+do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
char *context_offset = ((char *) ¤t_thread->context) + mappings[r];
long l;
if (r == I387_FISEG_REGNUM)
{
l = *((long *) context_offset) & 0xffff;
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r == I387_FOP_REGNUM)
{
l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r >= 0)
- regcache_raw_supply (current_regcache, r, context_offset);
+ regcache_raw_supply (regcache, r, context_offset);
else
{
for (r = 0; r < NUM_REGS; r++)
- do_win32_fetch_inferior_registers (r);
+ do_win32_fetch_inferior_registers (regcache, r);
}
#undef I387_ST0_REGNUM
}
static void
-win32_fetch_inferior_registers (int r)
+win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_fetch_inferior_registers (r);
+ do_win32_fetch_inferior_registers (regcache, r);
}
static void
-do_win32_store_inferior_registers (int r)
+do_win32_store_inferior_registers (const struct regcache *regcache, int r)
{
if (!current_thread)
/* Windows sometimes uses a non-existent thread id in its events */;
else if (r >= 0)
- regcache_raw_collect (current_regcache, r,
+ regcache_raw_collect (regcache, r,
((char *) ¤t_thread->context) + mappings[r]);
else
{
for (r = 0; r < NUM_REGS; r++)
- do_win32_store_inferior_registers (r);
+ do_win32_store_inferior_registers (regcache, r);
}
}
/* Store a new register value into the current thread context */
static void
-win32_store_inferior_registers (int r)
+win32_store_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_store_inferior_registers (r);
+ do_win32_store_inferior_registers (regcache, r);
}
static int psapi_loaded = 0;
if (step)
{
/* Single step by setting t bit */
- win32_fetch_inferior_registers (PS_REGNUM);
+ win32_fetch_inferior_registers (current_regcache, PS_REGNUM);
th->context.EFlags |= FLAG_TRACE_BIT;
}
}
static void
-do_win32_fetch_inferior_registers (int r)
+do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
char *context_offset = ((char *) ¤t_thread->context) + mappings[r];
long l;
if (r == I387_FISEG_REGNUM)
{
l = *((long *) context_offset) & 0xffff;
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r == I387_FOP_REGNUM)
{
l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
- regcache_raw_supply (current_regcache, r, (char *) &l);
+ regcache_raw_supply (regcache, r, (char *) &l);
}
else if (r >= 0)
- regcache_raw_supply (current_regcache, r, context_offset);
+ regcache_raw_supply (regcache, r, context_offset);
else
{
for (r = 0; r < NUM_REGS; r++)
- do_win32_fetch_inferior_registers (r);
+ do_win32_fetch_inferior_registers (regcache, r);
}
#undef I387_ST0_REGNUM
}
static void
-win32_fetch_inferior_registers (int r)
+win32_fetch_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_fetch_inferior_registers (r);
+ do_win32_fetch_inferior_registers (regcache, r);
}
static void
-do_win32_store_inferior_registers (int r)
+do_win32_store_inferior_registers (const struct regcache *regcache, int r)
{
if (!current_thread)
/* Windows sometimes uses a non-existent thread id in its events */;
else if (r >= 0)
- regcache_raw_collect (current_regcache, r,
+ regcache_raw_collect (regcache, r,
((char *) ¤t_thread->context) + mappings[r]);
else
{
for (r = 0; r < NUM_REGS; r++)
- do_win32_store_inferior_registers (r);
+ do_win32_store_inferior_registers (regcache, r);
}
}
/* Store a new register value into the current thread context */
static void
-win32_store_inferior_registers (int r)
+win32_store_inferior_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events */
if (current_thread)
- do_win32_store_inferior_registers (r);
+ do_win32_store_inferior_registers (regcache, r);
}
static int psapi_loaded = 0;
if (step)
{
/* Single step by setting t bit */
- win32_fetch_inferior_registers (PS_REGNUM);
+ win32_fetch_inferior_registers (current_regcache, PS_REGNUM);
th->context.EFlags |= FLAG_TRACE_BIT;
}