from the current thread. */
static void
-fetch_gregs_from_thread (struct regcache *regcache)
+fetch_gregs_from_thread (struct regcache *regcache, ptid_t ptid)
{
int ret, tid;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
and arm. */
gdb_static_assert (sizeof (regs) >= 18 * 4);
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
iovec.iov_base = ®s;
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
from the current thread. */
static void
-fetch_fpregs_from_thread (struct regcache *regcache)
+fetch_fpregs_from_thread (struct regcache *regcache, ptid_t ptid)
{
int ret, tid;
elf_fpregset_t regs;
and arm. */
gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
iovec.iov_base = ®s;
static void
aarch64_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache,
- int regno)
+ ptid_t ptid, int regno)
{
if (regno == -1)
{
- fetch_gregs_from_thread (regcache);
- fetch_fpregs_from_thread (regcache);
+ fetch_gregs_from_thread (regcache, ptid);
+ fetch_fpregs_from_thread (regcache, ptid);
}
else if (regno < AARCH64_V0_REGNUM)
- fetch_gregs_from_thread (regcache);
+ fetch_gregs_from_thread (regcache, ptid);
else
- fetch_fpregs_from_thread (regcache);
+ fetch_fpregs_from_thread (regcache, ptid);
}
/* Implement the "to_store_register" target_ops method. */
}
/* Fetch register REGNO if != -1 or all registers otherwise in the
- thread/process specified by inferior_ptid. */
+ thread/process specified by PTID. */
static void
aix_thread_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct thread_info *thread;
pthdb_tid_t tid;
struct target_ops *beneath = find_target_beneath (ops);
- if (!PD_TID (inferior_ptid))
- beneath->to_fetch_registers (beneath, regcache, regno);
+ if (!PD_TID (ptid))
+ beneath->to_fetch_registers (beneath, regcache, ptid, regno);
else
{
- thread = find_thread_ptid (inferior_ptid);
+ thread = find_thread_ptid (ptid);
tid = thread->priv->tid;
if (tid == PTHDB_INVALID_TID)
}
/* Store gdb's current view of the register set into the
- thread/process specified by inferior_ptid. */
+ thread/process specified by PTID. */
static void
aix_thread_store_registers (struct target_ops *ops,
static void
alphabsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
struct reg gregs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
alphabsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (regno == -1 || getregs_supplies (regno))
{
struct reg gregs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
alphabsd_fill_reg (regcache, (char *) &gregs, regno);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &gregs, 0) == -1)
perror_with_name (_("Couldn't write registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
static void
amd64bsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
perror_with_name (_("Couldn't get extended state status"));
}
#endif
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
amd64bsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
perror_with_name (_("Couldn't get extended state status"));
amd64_collect_xsave (regcache, regnum, xstateregs, 0);
- if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
perror_with_name (_("Couldn't write extended state status"));
return;
}
#endif
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
- if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
static void
amd64_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
into regcache. */
static void
-fetch_fpregs (struct regcache *regcache)
+fetch_fpregs (struct regcache *regcache, ptid_t ptid)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
regcache. */
static void
-fetch_regs (struct regcache *regcache)
+fetch_regs (struct regcache *regcache, ptid_t ptid)
{
int ret, regno, tid;
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
#define IWMMXT_REGS_SIZE (16 * 8 + 6 * 4)
static void
-fetch_wmmx_regs (struct regcache *regcache)
+fetch_wmmx_regs (struct regcache *regcache, ptid_t ptid)
{
char regbuf[IWMMXT_REGS_SIZE];
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
}
static void
-fetch_vfp_regs (struct regcache *regcache)
+fetch_vfp_regs (struct regcache *regcache, ptid_t ptid)
{
gdb_byte regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
static void
arm_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (-1 == regno)
{
- fetch_regs (regcache);
+ fetch_regs (regcache, ptid);
if (tdep->have_wmmx_registers)
- fetch_wmmx_regs (regcache);
+ fetch_wmmx_regs (regcache, ptid);
if (tdep->vfp_register_count > 0)
- fetch_vfp_regs (regcache);
+ fetch_vfp_regs (regcache, ptid);
if (tdep->have_fpa_registers)
- fetch_fpregs (regcache);
+ fetch_fpregs (regcache, ptid);
}
else
{
if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
- fetch_regs (regcache);
+ fetch_regs (regcache, ptid);
else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM)
- fetch_fpregs (regcache);
+ fetch_fpregs (regcache, ptid);
else if (tdep->have_wmmx_registers
&& regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
- fetch_wmmx_regs (regcache);
+ fetch_wmmx_regs (regcache, ptid);
else if (tdep->vfp_register_count > 0
&& regno >= ARM_D0_REGNUM
&& regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
- fetch_vfp_regs (regcache);
+ fetch_vfp_regs (regcache, ptid);
}
}
}
static void
-fetch_register (struct regcache *regcache, int regno)
+fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
{
struct reg inferior_registers;
int ret;
- ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ ret = ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
}
static void
-fetch_regs (struct regcache *regcache)
+fetch_regs (struct regcache *regcache, ptid_t ptid)
{
struct reg inferior_registers;
int ret;
int regno;
- ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ ret = ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, 0);
if (ret < 0)
}
static void
-fetch_fp_register (struct regcache *regcache, int regno)
+fetch_fp_register (struct regcache *regcache, ptid_t ptid, int regno)
{
struct fpreg inferior_fp_registers;
int ret;
- ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ ret = ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
}
static void
-fetch_fp_regs (struct regcache *regcache)
+fetch_fp_regs (struct regcache *regcache, ptid_t ptid)
{
struct fpreg inferior_fp_registers;
int ret;
int regno;
- ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ ret = ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
if (ret < 0)
static void
armnbsd_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (regno >= 0)
{
if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
else
- fetch_fp_register (regcache, regno);
+ fetch_fp_register (regcache, ptid, regno);
}
else
{
- fetch_regs (regcache);
- fetch_fp_regs (regcache);
+ fetch_regs (regcache, ptid);
+ fetch_fp_regs (regcache, ptid);
}
}
static void
bsd_kvm_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct nlist nl[2];
}
static void
-bsd_uthread_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+bsd_uthread_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
- ptid_t ptid = inferior_ptid;
CORE_ADDR addr = ptid_get_tid (ptid);
struct target_ops *beneath = find_target_beneath (ops);
CORE_ADDR active_addr;
/* Always fetch the appropriate registers from the layer beneath. */
- beneath->to_fetch_registers (beneath, regcache, regnum);
+ beneath->to_fetch_registers (beneath, regcache, ptid, regnum);
/* FIXME: That might have gotten us more than we asked for. Make
sure we overwrite all relevant registers with values from the
}
/* Fetch all registers from core file. */
- target_fetch_registers (get_current_regcache (), -1);
+ target_fetch_registers (get_current_regcache (), inferior_ptid, -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 (struct target_ops *ops,
- struct regcache *regcache, int regno)
+get_core_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regno)
{
int i;
struct gdbarch *gdbarch;
static void
ctf_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct bt_ctf_event *event = NULL;
fbsd_corefile_thread (struct thread_info *info,
struct fbsd_corefile_thread_data *args)
{
- struct cleanup *old_chain;
struct regcache *regcache;
regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
- old_chain = save_inferior_ptid ();
- inferior_ptid = info->ptid;
- target_fetch_registers (regcache, -1);
- do_cleanups (old_chain);
+ target_fetch_registers (regcache, info->ptid, -1);
args->note_data = fbsd_collect_thread_registers
(regcache, info->ptid, args->obfd, args->note_data,
static void
go32_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (regno >= 0)
fetch_register (regcache, regno);
static void
go32_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
unsigned r;
/* Fetch one register. */
static void
-fetch_register (struct regcache *regcache, int regno)
+fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
}
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
static void
hppa_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (-1 == regno)
{
for (regno = 0;
regno < gdbarch_num_regs (get_regcache_arch (regcache));
regno++)
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
}
else
{
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
}
}
static void
hppanbsd_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
hppanbsd_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
hppanbsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
hppanbsd_collect_fpregset (regcache, &fpregs, regnum);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
static void
hppaobsd_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
hppaobsd_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || hppaobsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
hppaobsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
hppaobsd_collect_fpregset (regcache, &fpregs, regnum);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
static void
i386bsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
void *xstateregs;
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
perror_with_name (_("Couldn't get extended state status"));
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
- && ptrace(PT_GETXMMREGS, get_ptrace_pid (inferior_ptid),
+ && ptrace(PT_GETXMMREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
{
have_ptrace_xmmregs = 1;
{
have_ptrace_xmmregs = 0;
#endif
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
i386bsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
void *xstateregs;
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
perror_with_name (_("Couldn't get extended state status"));
i387_collect_xsave (regcache, -1, xstateregs, 0);
- if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETXSTATE, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
perror_with_name (_("Couldn't write extended state status"));
return;
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
- && ptrace(PT_GETXMMREGS, get_ptrace_pid (inferior_ptid),
+ && ptrace(PT_GETXMMREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
{
have_ptrace_xmmregs = 1;
i387_collect_fxsave (regcache, regnum, xmmregs);
- if (ptrace (PT_SETXMMREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETXMMREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
perror_with_name (_("Couldn't write XMM registers"));
}
{
have_ptrace_xmmregs = 0;
#endif
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
i387_collect_fsave (regcache, regnum, &fpregs);
- if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
#ifdef HAVE_PT_GETXMMREGS
Otherwise, REGNO specifies which register (so we can save time). */
static void
i386_darwin_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
- thread_t current_thread = ptid_get_tid (inferior_ptid);
+ thread_t current_thread = ptid_get_tid (ptid);
int fetched = 0;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
static void
i386_darwin_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
- thread_t current_thread = ptid_get_tid (inferior_ptid);
+ thread_t current_thread = ptid_get_tid (ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
#ifdef BFD64
/* Fetch register REGNO, or all regs if REGNO is -1. */
static void
gnu_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct proc *thread;
inf_update_procs (gnu_current_inf);
thread = inf_tid_to_thread (gnu_current_inf,
- ptid_get_lwp (inferior_ptid));
+ ptid_get_lwp (ptid));
if (!thread)
error (_("Can't fetch registers from thread %s: No such thread"),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (ptid));
if (regno < I386_NUM_GREGS || regno == -1)
{
/* Store at least register REGNO, or all regs if REGNO == -1. */
static void
gnu_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct proc *thread;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
inf_update_procs (gnu_current_inf);
thread = inf_tid_to_thread (gnu_current_inf,
- ptid_get_lwp (inferior_ptid));
+ ptid_get_lwp (ptid));
if (!thread)
error (_("Couldn't store registers into thread %s: No such thread"),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (ptid));
if (regno < I386_NUM_GREGS || regno == -1)
{
/* Fetch one register. */
static void
-fetch_register (struct regcache *regcache, int regno)
+fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
{
int tid;
int val;
}
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid,
static void
i386_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
int tid;
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
if (regno == -1 || regno == i)
- fetch_register (regcache, i);
+ fetch_register (regcache, ptid, i);
return;
}
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- i386_linux_fetch_inferior_registers (ops, regcache, regno);
+ i386_linux_fetch_inferior_registers (ops, regcache, ptid, regno);
return;
}
/* Fetch register REGNUM from the inferior. */
static void
-ia64_linux_fetch_register (struct regcache *regcache, int regnum)
+ia64_linux_fetch_register (struct regcache *regcache, ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR addr;
/* Cater for systems like GNU/Linux, that implement threads as
separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
+ pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = ptid_get_pid (ptid);
/* This isn't really an address, but ptrace thinks of it as one. */
addr = ia64_register_addr (gdbarch, regnum);
static void
ia64_linux_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1)
for (regnum = 0;
regnum < gdbarch_num_regs (get_regcache_arch (regcache));
regnum++)
- ia64_linux_fetch_register (regcache, regnum);
+ ia64_linux_fetch_register (regcache, ptid, regnum);
else
- ia64_linux_fetch_register (regcache, regnum);
+ ia64_linux_fetch_register (regcache, ptid, regnum);
}
/* Store register REGNUM into the inferior. */
static void
inf_child_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1)
{
/* Fetch register REGNUM from the inferior. */
static void
-inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
+inf_ptrace_fetch_register (struct regcache *regcache, ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR addr;
/* Cater for systems like GNU/Linux, that implement threads as
separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
+ pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = ptid_get_pid (ptid);
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
for all registers. */
static void
-inf_ptrace_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+inf_ptrace_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1)
for (regnum = 0;
regnum < gdbarch_num_regs (get_regcache_arch (regcache));
regnum++)
- inf_ptrace_fetch_register (regcache, regnum);
+ inf_ptrace_fetch_register (regcache, ptid, regnum);
else
- inf_ptrace_fetch_register (regcache, regnum);
+ inf_ptrace_fetch_register (regcache, ptid, regnum);
}
/* Store register REGNUM into the inferior. */
LONGEST siginfo_size = 0;
regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
-
- old_chain = save_inferior_ptid ();
- inferior_ptid = info->ptid;
- target_fetch_registers (regcache, -1);
+ target_fetch_registers (regcache, info->ptid, -1);
siginfo_data = linux_get_siginfo_data (args->gdbarch, &siginfo_size);
- do_cleanups (old_chain);
old_chain = make_cleanup (xfree, siginfo_data);
static void
m32r_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
int tid;
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
/* Use the PTRACE_GETREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
registers). */
static void
m32r_linux_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
int tid;
/* GNU/Linux LWP ID's are process ID's. */
- if ((tid = ptid_get_lwp (inferior_ptid)) == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ if ((tid = ptid_get_lwp (ptid)) == 0)
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
/* Use the PTRACE_SETREGS request whenever possible, since it
transfers more registers in one system call. */
static void
m68kbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
m68kbsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
/* Fetch one register. */
static void
-fetch_register (struct regcache *regcache, int regno)
+fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
long regaddr, val;
int tid;
/* Overload thread id onto process id. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* no thread id, just use
+ tid = ptid_get_pid (ptid); /* no thread id, just use
process id. */
regaddr = 4 * regmap[regno];
Otherwise, REGNO specifies which register (so we can save time). */
static void
-old_fetch_inferior_registers (struct regcache *regcache, int regno)
+old_fetch_inferior_registers (struct regcache *regcache, ptid_t ptid, int regno)
{
if (regno >= 0)
{
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
}
else
{
regno < gdbarch_num_regs (get_regcache_arch (regcache));
regno++)
{
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
}
}
}
static void
m68k_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
int tid;
GETREGS request isn't available. */
if (! have_ptrace_getregs)
{
- old_fetch_inferior_registers (regcache, regno);
+ old_fetch_inferior_registers (regcache, ptid, regno);
return;
}
/* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = ptid_get_pid (ptid); /* Not a threaded program. */
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
/* The call above might reset `have_ptrace_getregs'. */
if (! have_ptrace_getregs)
{
- old_fetch_inferior_registers (regcache, -1);
+ old_fetch_inferior_registers (regcache, ptid, -1);
return;
}
static void
m88kbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
static void
m88kbsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
m88kbsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
static void
mips_fbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
mips_fbsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
mips_fbsd_collect_gregs (regcache, regnum, (char *) ®s,
sizeof (register_t));
- if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs,
sizeof (f_register_t));
- if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
PTRACE_PEEKUSER and PTRACE_POKEUSER. */
static void (*super_fetch_registers) (struct target_ops *,
- struct regcache *, int);
+ struct regcache *, ptid_t, int);
static void (*super_store_registers) (struct target_ops *,
struct regcache *, int);
static void
mips64_linux_regsets_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int is_fp, is_dsp;
else
is_dsp = 0;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = ptid_get_pid (ptid);
if (regno == -1 || (!is_fp && !is_dsp))
{
}
if (is_dsp)
- super_fetch_registers (ops, regcache, regno);
+ super_fetch_registers (ops, regcache, ptid, regno);
else if (regno == -1 && have_dsp)
{
for (regi = mips_regnum (gdbarch)->dspacc;
regi < mips_regnum (gdbarch)->dspacc + 6;
regi++)
- super_fetch_registers (ops, regcache, regi);
- super_fetch_registers (ops, regcache, mips_regnum (gdbarch)->dspctl);
+ super_fetch_registers (ops, regcache, ptid, regi);
+ super_fetch_registers (ops, regcache, ptid,
+ mips_regnum (gdbarch)->dspctl);
}
}
static void
mips64_linux_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
/* Unless we already know that PTRACE_GETREGS does not work, try it. */
if (have_ptrace_regsets)
- mips64_linux_regsets_fetch_registers (ops, regcache, regnum);
+ mips64_linux_regsets_fetch_registers (ops, regcache, ptid, 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 (ops, regcache, regnum);
+ super_fetch_registers (ops, regcache, ptid, regnum);
}
/* Store REGNO (or all registers if REGNO == -1) to the target
static void
mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1 || getregs_supplies (gdbarch, regno))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
mipsnbsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1 || getregs_supplies (gdbarch, regno))
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
mipsnbsd_fill_reg (regcache, (char *) ®s, regno);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
static void
mips64obsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
static void
mips64obsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
mips64obsd_collect_gregset (regcache, ®s, regnum);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
and update gdb's idea of their current values. */
static void
procfs_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
union
{
reg;
int regsize;
- procfs_set_thread (inferior_ptid);
+ procfs_set_thread (ptid);
if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK)
nto_supply_gregset (regcache, (char *) ®.greg);
if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size)
static void
procfs_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
union
{
int len, regset, regsize, dev_set, err;
char *data;
- if (ptid_equal (inferior_ptid, null_ptid))
+ if (ptid_equal (ptid, null_ptid))
return;
- procfs_set_thread (inferior_ptid);
+ procfs_set_thread (ptid);
if (regno == -1)
{
static void
ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
gdb_gregset_t regs;
- if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
const struct regset *fpregset = ppc_fbsd_fpregset ();
gdb_fpregset_t fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
static void
ppcfbsd_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
gdb_gregset_t regs;
- if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
fill_gregset (regcache, ®s, regno);
- if (ptrace (PT_SETREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
{
gdb_fpregset_t fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
fill_fpregset (regcache, &fpregs, regno);
- if (ptrace (PT_SETFPREGS, ptid_get_lwp (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_lwp (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't set FP registers"));
}
point registers depending upon the value of regno. */
static void
ppc_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
/* Overload thread id onto process id. */
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = ptid_get_lwp (ptid);
/* No thread id, just use process id. */
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = ptid_get_pid (ptid);
if (regno == -1)
fetch_ppc_registers (regcache, tid);
static void
ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
static void
ppcobsd_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get floating point status"));
static void
ppc_ravenscar_generic_fetch_registers
(const struct ravenscar_reg_info *reg_info,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache, ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
const int num_regs = gdbarch_num_regs (gdbarch);
CORE_ADDR thread_descriptor_address;
/* The tid is the thread_id field, which is a pointer to the thread. */
- thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid);
+ thread_descriptor_address = (CORE_ADDR) ptid_get_tid (ptid);
/* Read registers. */
for (current_regnum = 0; current_regnum < num_regs; current_regnum++)
for most PowerPC targets. */
static void
-ppc_ravenscar_powerpc_fetch_registers (struct regcache *regcache, int regnum)
+ppc_ravenscar_powerpc_fetch_registers (struct regcache *regcache, ptid_t ptid,
+ int regnum)
{
- ppc_ravenscar_generic_fetch_registers (&ppc_reg_info, regcache, regnum);
+ ppc_ravenscar_generic_fetch_registers (&ppc_reg_info, regcache, ptid, regnum);
}
/* Implement the to_store_registers ravenscar_arch_ops method
for E500 targets. */
static void
-ppc_ravenscar_e500_fetch_registers (struct regcache *regcache, int regnum)
+ppc_ravenscar_e500_fetch_registers (struct regcache *regcache, ptid_t ptid,
+ int regnum)
{
- ppc_ravenscar_generic_fetch_registers (&e500_reg_info, regcache, regnum);
+ ppc_ravenscar_generic_fetch_registers (&e500_reg_info, regcache, ptid,
+ regnum);
}
/* Implement the to_store_registers ravenscar_arch_ops method
ps_err_e
ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
{
- struct cleanup *old_chain = save_inferior_ptid ();
struct regcache *regcache;
+ ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
- inferior_ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
-
- target_fetch_registers (regcache, -1);
+ regcache = get_thread_arch_regcache (ptid, target_gdbarch ());
+ target_fetch_registers (regcache, ptid, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
- do_cleanups (old_chain);
return PS_OK;
}
ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
gdb_prfpregset_t *fpregset)
{
- struct cleanup *old_chain = save_inferior_ptid ();
struct regcache *regcache;
+ ptid_t ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
- inferior_ptid = ptid_build (ptid_get_pid (ph->ptid), lwpid, 0);
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
-
- target_fetch_registers (regcache, -1);
+ regcache = get_thread_arch_regcache (ptid, target_gdbarch ());
+ target_fetch_registers (regcache, ptid, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
- do_cleanups (old_chain);
return PS_OK;
}
static void procfs_interrupt (struct target_ops *self, ptid_t);
static void procfs_files_info (struct target_ops *);
static void procfs_fetch_registers (struct target_ops *,
- struct regcache *, int);
+ struct regcache *, ptid_t, int);
static void procfs_store_registers (struct target_ops *,
struct regcache *, int);
static void procfs_pass_signals (struct target_ops *self,
static void
procfs_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
gdb_gregset_t *gregs;
procinfo *pi;
- int pid = ptid_get_pid (inferior_ptid);
- int tid = ptid_get_lwp (inferior_ptid);
+ int pid = ptid_get_pid (ptid);
+ int tid = ptid_get_lwp (ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
pi = find_procinfo_or_die (pid, tid);
if (pi == NULL)
error (_("procfs: fetch_registers failed to find procinfo for %s"),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (ptid));
gregs = proc_get_gregs (pi);
if (gregs == NULL)
static char *ravenscar_extra_thread_info (struct target_ops *self,
struct thread_info *tp);
static int ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid);
-static void ravenscar_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum);
static void ravenscar_store_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
static void ravenscar_prepare_to_store (struct target_ops *self,
}
static void
-ravenscar_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ravenscar_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct target_ops *beneath = find_target_beneath (ops);
if (!ravenscar_runtime_initialized ()
- || ptid_equal (inferior_ptid, base_magic_null_ptid)
- || ptid_equal (inferior_ptid, ravenscar_running_thread ()))
- beneath->to_fetch_registers (beneath, regcache, regnum);
+ || ptid_equal (ptid, base_magic_null_ptid)
+ || ptid_equal (ptid, ravenscar_running_thread ()))
+ beneath->to_fetch_registers (beneath, regcache, ptid, regnum);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- arch_ops->to_fetch_registers (regcache, regnum);
+ arch_ops->to_fetch_registers (regcache, ptid, regnum);
}
}
struct ravenscar_arch_ops
{
- void (*to_fetch_registers) (struct regcache *, int);
+ void (*to_fetch_registers) (struct regcache *, ptid_t, int);
void (*to_store_registers) (struct regcache *, int);
void (*to_prepare_to_store) (struct regcache *);
};
static void
record_btrace_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct btrace_insn_iterator *replay;
struct thread_info *tp;
- tp = find_thread_ptid (inferior_ptid);
+ tp = find_thread_ptid (ptid);
gdb_assert (tp != NULL);
replay = tp->btrace.replay;
{
struct target_ops *t = ops->beneath;
- t->to_fetch_registers (t, regcache, regno);
+ t->to_fetch_registers (t, regcache, ptid, regno);
}
}
int i;
/* Get record_full_core_regbuf. */
- target_fetch_registers (regcache, -1);
+ target_fetch_registers (regcache, inferior_ptid, -1);
record_full_core_regbuf = (gdb_byte *) xmalloc (MAX_REGISTER_SIZE * regnum);
for (i = 0; i < regnum; i ++)
regcache_raw_collect (regcache, i,
static void
record_full_core_fetch_registers (struct target_ops *ops,
struct regcache *regcache,
- int regno)
+ ptid_t ptid, int regno)
{
if (regno < 0)
{
struct cleanup *old_chain = save_inferior_ptid ();
inferior_ptid = regcache->ptid;
- target_fetch_registers (regcache, regnum);
+ target_fetch_registers (regcache, inferior_ptid, regnum);
do_cleanups (old_chain);
/* A number of targets can't access the whole set of raw
static void
gdbsim_fetch_register (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct inferior *inf = find_inferior_ptid (ptid);
struct sim_inferior_data *sim_data
- = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
+ = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED);
if (regno == -1)
{
for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
- gdbsim_fetch_register (ops, regcache, regno);
+ gdbsim_fetch_register (ops, regcache, ptid, regno);
return;
}
}
static void
-remote_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+remote_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
set_remote_traceframe ();
- set_general_thread (inferior_ptid);
+ set_general_thread (ptid);
if (regnum >= 0)
{
/* Fetch register REGNO from the inferior. */
static void
-fetch_register (struct regcache *regcache, int regno)
+fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int addr[MAX_REGISTER_SIZE];
/* Floating-point registers. */
if (isfloat)
- rs6000_ptrace32 (PT_READ_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
+ rs6000_ptrace32 (PT_READ_FPR, ptid_get_pid (ptid), addr, nr, 0);
/* Bogus register number. */
else if (nr < 0)
else
{
if (!ARCH64 ())
- *addr = rs6000_ptrace32 (PT_READ_GPR, ptid_get_pid (inferior_ptid),
+ *addr = rs6000_ptrace32 (PT_READ_GPR, ptid_get_pid (ptid),
(int *) nr, 0, 0);
else
{
/* PT_READ_GPR requires the buffer parameter to point to long long,
even if the register is really only 32 bits. */
long long buf;
- rs6000_ptrace64 (PT_READ_GPR, ptid_get_pid (inferior_ptid),
+ rs6000_ptrace64 (PT_READ_GPR, ptid_get_pid (ptid),
nr, 0, &buf);
if (register_size (gdbarch, regno) == 8)
memcpy (addr, &buf, 8);
static void
rs6000_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno != -1)
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
else
{
regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
regno++)
{
- fetch_register (regcache, regno);
+ fetch_register (regcache, ptid, regno);
}
/* Read general purpose floating point registers. */
if (tdep->ppc_fp0_regnum >= 0)
for (regno = 0; regno < ppc_num_fprs; regno++)
- fetch_register (regcache, tdep->ppc_fp0_regnum + regno);
+ fetch_register (regcache, ptid, tdep->ppc_fp0_regnum + regno);
/* Read special registers. */
- fetch_register (regcache, gdbarch_pc_regnum (gdbarch));
- 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);
+ fetch_register (regcache, ptid, gdbarch_pc_regnum (gdbarch));
+ fetch_register (regcache, ptid, tdep->ppc_ps_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_cr_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_lr_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_ctr_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_xer_regnum);
if (tdep->ppc_fpscr_regnum >= 0)
- fetch_register (regcache, tdep->ppc_fpscr_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_fpscr_regnum);
if (tdep->ppc_mq_regnum >= 0)
- fetch_register (regcache, tdep->ppc_mq_regnum);
+ fetch_register (regcache, ptid, tdep->ppc_mq_regnum);
}
}
this for all registers. */
static void
s390_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
- int tid = s390_inferior_tid ();
+ int tid = s390_inferior_tid (ptid);
if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
fetch_regs (regcache, tid);
static void
shnbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+ struct regcache *regcache,
+ ptid_t ptid, int regno)
{
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
{
struct reg inferior_registers;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
perror_with_name (_("Couldn't get registers"));
static void
sol_thread_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
thread_t thread;
td_thrhandle_t thandle;
gdb_fpregset_t *fpregset_p = &fpregset;
struct target_ops *beneath = find_target_beneath (ops);
- if (!ptid_tid_p (inferior_ptid))
+ if (!ptid_tid_p (ptid))
{
/* It's an LWP; pass the request on to the layer beneath. */
- beneath->to_fetch_registers (beneath, regcache, regnum);
+ beneath->to_fetch_registers (beneath, regcache, ptid, regnum);
return;
}
- /* Solaris thread: convert INFERIOR_PTID into a td_thrhandle_t. */
- thread = ptid_get_tid (inferior_ptid);
+ /* Solaris thread: convert PTID into a td_thrhandle_t. */
+ thread = ptid_get_tid (ptid);
if (thread == 0)
error (_("sol_thread_fetch_registers: thread == 0"));
void
sparc_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int pid;
These functions should instead be paramaterized with an explicit
object (struct regcache, struct thread_info?) into which the LWPs
registers can be written. */
- pid = ptid_get_lwp (inferior_ptid);
+ pid = ptid_get_lwp (ptid);
if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = ptid_get_pid (ptid);
if (regnum == SPARC_G0_REGNUM)
{
extern struct target_ops *sparc_target (void);
extern void sparc_fetch_inferior_registers (struct target_ops *,
- struct regcache *, int);
+ struct regcache *, ptid_t, int);
extern void sparc_store_inferior_registers (struct target_ops *,
struct regcache *, int);
#include "ravenscar-thread.h"
#include "sparc-ravenscar-thread.h"
-static void sparc_ravenscar_fetch_registers (struct regcache *regcache,
- int regnum);
static void sparc_ravenscar_store_registers (struct regcache *regcache,
int regnum);
static void sparc_ravenscar_prepare_to_store (struct regcache *regcache);
thread. */
static void
-sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
+sparc_ravenscar_fetch_registers (struct regcache *regcache, ptid_t ptid,
+ int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
const int sp_regnum = gdbarch_sp_regnum (gdbarch);
ULONGEST stack_address;
/* The tid is the thread_id field, which is a pointer to the thread. */
- thread_descriptor_address = (CORE_ADDR) ptid_get_tid (inferior_ptid);
+ thread_descriptor_address = (CORE_ADDR) ptid_get_tid (ptid);
/* Read the saved SP in the context buffer. */
current_address = thread_descriptor_address
/* Override the to_fetch_registers routine. */
static void
-spu_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+spu_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{
- ops_beneath->to_fetch_registers (ops_beneath, regcache, regno);
+ ops_beneath->to_fetch_registers (ops_beneath, regcache, ptid, regno);
return;
}
/* We must be stopped on a spu_run system call. */
- if (!parse_spufs_run (inferior_ptid, &spufs_fd, &spufs_addr))
+ if (!parse_spufs_run (ptid, &spufs_fd, &spufs_addr))
return;
/* The ID register holds the spufs file handle. */
}
static void
-delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
{
self = self->beneath;
- self->to_fetch_registers (self, arg1, arg2);
+ self->to_fetch_registers (self, arg1, arg2, arg3);
}
static void
-tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
{
}
static void
-debug_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+debug_fetch_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
{
fprintf_unfiltered (gdb_stdlog, "-> %s->to_fetch_registers (...)\n", debug_target.to_shortname);
- debug_target.to_fetch_registers (&debug_target, arg1, arg2);
+ debug_target.to_fetch_registers (&debug_target, arg1, arg2, arg3);
fprintf_unfiltered (gdb_stdlog, "<- %s->to_fetch_registers (", debug_target.to_shortname);
target_debug_print_struct_target_ops_p (&debug_target);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_struct_regcache_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_ptid_t (arg2);
+ fputs_unfiltered (", ", gdb_stdlog);
+ target_debug_print_int (arg3);
fputs_unfiltered (")\n", gdb_stdlog);
}
}
void
-target_fetch_registers (struct regcache *regcache, int regno)
+target_fetch_registers (struct regcache *regcache, ptid_t ptid, int regno)
{
- current_target.to_fetch_registers (¤t_target, regcache, regno);
+ current_target.to_fetch_registers (¤t_target, regcache, ptid, regno);
if (targetdebug)
debug_print_register ("target_fetch_registers", regcache, regno);
}
ptid_t, struct target_waitstatus *,
int TARGET_DEBUG_PRINTER (target_debug_print_options))
TARGET_DEFAULT_FUNC (default_target_wait);
- void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
+ void (*to_fetch_registers) (struct target_ops *, struct regcache *, ptid_t,
+ int)
TARGET_DEFAULT_IGNORE ();
void (*to_store_registers) (struct target_ops *, struct regcache *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
struct target_waitstatus *status,
int options);
-/* Fetch at least register REGNO, or all regs if regno == -1. No result. */
+/* Fetch at least register REGNO of thread PTID from the target and store it in
+ REGCACHE. Fetch all registers if REGNO == -1. */
-extern void target_fetch_registers (struct regcache *regcache, int regno);
+extern void target_fetch_registers (struct regcache *regcache, ptid_t ptid,
+ int 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
static void
fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
elf_gregset_t regs;
int tid;
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (ptid);
if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ tid = ptid_get_pid (ptid);
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
requested register from it. */
static void
-tfile_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+tfile_fetch_registers (struct target_ops *ops, struct regcache *regcache,
+ ptid_t ptid, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int offset, regn, regsize, dummy;
static void
vaxbsd_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
struct reg regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
static void
windows_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int r)
+ struct regcache *regcache,
+ ptid_t ptid, int r)
{
- windows_thread_info *th = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
+ windows_thread_info *th = thread_rec (ptid_get_tid (ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
thread id in its events. */
return;
}
-/* Fetch greg-register(s) from process/thread TID
- and store value(s) in GDB's register array. */
+/* Fetch greg-register(s) from process/thread PTID
+ and store value(s) in REGCACHE. */
static void
-fetch_gregs (struct regcache *regcache, int regnum)
+fetch_gregs (struct regcache *regcache, ptid_t ptid, int regnum)
{
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = ptid_get_lwp (ptid);
gdb_gregset_t regs;
int areg;
interface provides special requests for this. */
static void
-fetch_xtregs (struct regcache *regcache, int regnum)
+fetch_xtregs (struct regcache *regcache, ptid_t ptid, int regnum)
{
- int tid = ptid_get_lwp (inferior_ptid);
+ int tid = ptid_get_lwp (ptid);
const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE];
static void
xtensa_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+ struct regcache *regcache,
+ ptid_t ptid, int regnum)
{
if (regnum == -1)
{
- fetch_gregs (regcache, regnum);
- fetch_xtregs (regcache, regnum);
+ fetch_gregs (regcache, ptid, regnum);
+ fetch_xtregs (regcache, ptid, regnum);
}
else if ((regnum < xtreg_lo) || (regnum > xtreg_high))
- fetch_gregs (regcache, regnum);
+ fetch_gregs (regcache, ptid, regnum);
else
- fetch_xtregs (regcache, regnum);
+ fetch_xtregs (regcache, ptid, regnum);
}
static void