]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Pass ptid to target_store_registers
authorSimon Marchi <simon.marchi@ericsson.com>
Tue, 7 Mar 2017 19:05:59 +0000 (14:05 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 7 Mar 2017 21:47:33 +0000 (16:47 -0500)
This patch adds a ptid parameter to the target_store_registers function
and the to_store_registers method of target_ops.  The implementations
are therefore expected to rely on this and not on inferior_ptid.

gdb/ChangeLog:

* target-delegates.c: Re-generate.
* target.h (struct target_ops) <to_store_registers>: Add ptid
parameter.
(target_store_registers): Likewise.
* target.c (target_store_registers): Likewise.
* aarch64-linux-nat.c (store_gregs_to_thread,
store_fpregs_to_thread, aarch64_linux_store_inferior_registers):
Add ptid parameter and use it.
* aix-thread.c (aix_thread_store_registers): Add ptid parameter
and use it.
* amd64-linux-nat.c (amd64_linux_store_inferior_registers): Add
ptid parameter and use it.
* arm-linux-nat.c (store_fpregs, store_regs, store_wmmx_regs,
store_vfp_regs, arm_linux_store_inferior_registers): Likewise.
* arm-nbsd-nat.c (store_register, store_fp_register,
armnbsd_store_registers): Likewise.
* bsd-uthread.c (bsd_uthread_store_registers): Likewise.
* hppa-linux-nat.c (store_register,
hppa_linux_store_inferior_registers): Likewise.
* i386-linux-nat.c (store_register,
i386_linux_store_inferior_registers): Likewise.
* ia64-linux-nat.c (ia64_linux_store_register,
ia64_linux_store_registers): Likewise.
* inf-child.c (inf_child_store_inferior_registers): Add ptid
parameter.
* inf-ptrace.c (inf_ptrace_store_register,
inf_ptrace_store_registers): Likewise.
* m68k-linux-nat.c (store_register,
old_store_inferior_registers,
m68k_linux_store_inferior_registers): Likewise.
* mips-linux-nat.c (super_store_registers,
mips64_linux_regsets_store_registers,
mips64_linux_store_registers): Likewise.
* ppc-linux-nat.c (ppc_linux_store_inferior_registers):
Likewise.
* ppc-nbsd-nat.c (ppcnbsd_store_inferior_registers): Likewise.
* ppc-obsd-nat.c (ppcobsd_store_registers): Likewise.
* ppc-ravenscar-thread.c (ppc_ravenscar_generic_store_registers):
Add ptid parameter and use it.
(ppc_ravenscar_powerpc_store_registers): Likewise.
(ppc_ravenscar_e500_store_registers): Likewise.
* proc-service.c (ps_lsetregs, ps_lsetfpregs): Add ptid parameter
and use it.  Don't set/restore inferior_ptid.
* procfs.c (procfs_store_registers): Add ptid parameter and use
it.
* ravenscar-thread.c (ravenscar_store_registers): Add ptid
parameter and use it.  Remove declaration at top of file.
* ravenscar-thread.h (struct ravenscar_arch_ops)
<to_store_registers>: Add ptid parameter.
* record-btrace.c (record_btrace_store_registers): Add ptid
parameter and use it.
* record-full.c (record_full_store_registers): Likewise.
(record_full_core_store_registers): Add ptid parameter.
* regcache.c (regcache_raw_write): Pass ptid to
target_store_registers.
* remote.c (remote_store_registers): Add ptid parameter and use
it.
* remote-sim.c (gdbsim_store_register): Likewise.
* rs6000-aix-tdep.c (rs6000_push_dummy_call): Pass inferior_ptid
to target_store_registers.
* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call):
Likewise.
* rs6000-nat.c (store_register,
rs6000_store_inferior_registers): Add ptid parameter and use it.
* s390-linux-nat.c (s390_linux_store_inferior_registers):
Likewise.
* sh-nbsd-nat.c (shnbsd_store_inferior_registers): Likewise.
* sol-thread.c (sol_thread_store_registers): Likewise.
* sparc-nat.c (sparc_store_inferior_registers): Likewise.
* sparc-nat.h (sparc_store_inferior_registers): Likewise.
* sparc-ravenscar-thread.c (sparc_ravenscar_store_registers):
Add ptid parameter and use it.  Remove declaration at top of
file.
* spu-linux-nat.c (spu_store_inferior_registers): Add ptid
parameter and use it.
* spu-multiarch.c (spu_store_registers): Likewise.
* tilegx-linux-nat.c (store_inferior_registers): Likewise.
* vax-bsd-nat.c (vaxbsd_store_inferior_registers): Likewise.
* windows-nat.c (windows_store_inferior_registers): Likewise.
* xtensa-linux-nat.c (store_gregs, store_xtregs,
xtensa_linux_store_inferior_registers): Likewise.

44 files changed:
gdb/aarch64-linux-nat.c
gdb/aix-thread.c
gdb/amd64-linux-nat.c
gdb/arm-linux-nat.c
gdb/arm-nbsd-nat.c
gdb/bsd-uthread.c
gdb/hppa-linux-nat.c
gdb/i386-linux-nat.c
gdb/ia64-linux-nat.c
gdb/inf-child.c
gdb/inf-ptrace.c
gdb/m68k-linux-nat.c
gdb/mips-linux-nat.c
gdb/ppc-linux-nat.c
gdb/ppc-nbsd-nat.c
gdb/ppc-obsd-nat.c
gdb/ppc-ravenscar-thread.c
gdb/proc-service.c
gdb/procfs.c
gdb/ravenscar-thread.c
gdb/ravenscar-thread.h
gdb/record-btrace.c
gdb/record-full.c
gdb/regcache.c
gdb/remote-sim.c
gdb/remote.c
gdb/rs6000-aix-tdep.c
gdb/rs6000-lynx178-tdep.c
gdb/rs6000-nat.c
gdb/s390-linux-nat.c
gdb/sh-nbsd-nat.c
gdb/sol-thread.c
gdb/sparc-nat.c
gdb/sparc-nat.h
gdb/sparc-ravenscar-thread.c
gdb/spu-linux-nat.c
gdb/spu-multiarch.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h
gdb/tilegx-linux-nat.c
gdb/vax-bsd-nat.c
gdb/windows-nat.c
gdb/xtensa-linux-nat.c

index 3fc340496ccaa08f67e91571ae53494074da6cd7..e17a4a291682d27d6e014ed22aee8b31149a1332 100644 (file)
@@ -190,7 +190,7 @@ fetch_gregs_from_thread (struct regcache *regcache, ptid_t ptid)
    values in the GDB's register array.  */
 
 static void
-store_gregs_to_thread (const struct regcache *regcache)
+store_gregs_to_thread (const struct regcache *regcache, ptid_t ptid)
 {
   int ret, tid;
   elf_gregset_t regs;
@@ -200,7 +200,7 @@ store_gregs_to_thread (const struct regcache *regcache)
   /* Make sure REGS can hold all registers contents on both aarch64
      and arm.  */
   gdb_static_assert (sizeof (regs) >= 18 * 4);
-  tid = ptid_get_lwp (inferior_ptid);
+  tid = ptid_get_lwp (ptid);
 
   iovec.iov_base = &regs;
   if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
@@ -281,7 +281,7 @@ fetch_fpregs_from_thread (struct regcache *regcache, ptid_t ptid)
    values in the GDB's register array.  */
 
 static void
-store_fpregs_to_thread (const struct regcache *regcache)
+store_fpregs_to_thread (const struct regcache *regcache, ptid_t ptid)
 {
   int ret, tid;
   elf_fpregset_t regs;
@@ -291,7 +291,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
   /* Make sure REGS can hold all VFP registers contents on both aarch64
      and arm.  */
   gdb_static_assert (sizeof regs >= VFP_REGS_SIZE);
-  tid = ptid_get_lwp (inferior_ptid);
+  tid = ptid_get_lwp (ptid);
 
   iovec.iov_base = &regs;
 
@@ -365,17 +365,17 @@ aarch64_linux_fetch_inferior_registers (struct target_ops *ops,
 static void
 aarch64_linux_store_inferior_registers (struct target_ops *ops,
                                        struct regcache *regcache,
-                                       int regno)
+                                       ptid_t ptid, int regno)
 {
   if (regno == -1)
     {
-      store_gregs_to_thread (regcache);
-      store_fpregs_to_thread (regcache);
+      store_gregs_to_thread (regcache, ptid);
+      store_fpregs_to_thread (regcache, ptid);
     }
   else if (regno < AARCH64_V0_REGNUM)
-    store_gregs_to_thread (regcache);
+    store_gregs_to_thread (regcache, ptid);
   else
-    store_fpregs_to_thread (regcache);
+    store_fpregs_to_thread (regcache, ptid);
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
index b85c147f038e7f1edda16512108fb5a8fcaf748a..04144945dacc6d68f699be5d4d5ffe0b5d6eb349 100644 (file)
@@ -1657,17 +1657,18 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 
 static void
 aix_thread_store_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_store_registers (beneath, regcache, regno);
+  if (!PD_TID (ptid))
+    beneath->to_store_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)
index a9f61cddaca74296fe9dac85ce33224b9a3b4564..f9c81ea84b27590a05f3bbccf7f3f4020c9bd0bf 100644 (file)
@@ -212,15 +212,16 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 amd64_linux_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);
   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))
     {
index 86ac33d307257e1832a9766ffdaf001a2651cf1a..a1c50e27f3bc780eef10398de011e8606485bc6d 100644 (file)
@@ -107,13 +107,13 @@ fetch_fpregs (struct regcache *regcache, ptid_t ptid)
    the contents from regcache.  */
 
 static void
-store_fpregs (const struct regcache *regcache)
+store_fpregs (const 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)
@@ -188,13 +188,13 @@ fetch_regs (struct regcache *regcache, ptid_t ptid)
 }
 
 static void
-store_regs (const struct regcache *regcache)
+store_regs (const 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);
 
   /* Fetch the general registers.  */
   if (have_ptrace_getregset == TRIBOOL_TRUE)
@@ -262,13 +262,13 @@ fetch_wmmx_regs (struct regcache *regcache, ptid_t ptid)
 }
 
 static void
-store_wmmx_regs (const struct regcache *regcache)
+store_wmmx_regs (const 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)
@@ -328,7 +328,7 @@ fetch_vfp_regs (struct regcache *regcache, ptid_t ptid)
 }
 
 static void
-store_vfp_regs (const struct regcache *regcache)
+store_vfp_regs (const struct regcache *regcache, ptid_t ptid)
 {
   gdb_byte regbuf[VFP_REGS_SIZE];
   int ret, regno, tid;
@@ -336,7 +336,7 @@ store_vfp_regs (const struct regcache *regcache)
   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)
     {
@@ -414,34 +414,35 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 arm_linux_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);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (-1 == regno)
     {
-      store_regs (regcache);
+      store_regs (regcache, ptid);
       if (tdep->have_wmmx_registers)
-       store_wmmx_regs (regcache);
+       store_wmmx_regs (regcache, ptid);
       if (tdep->vfp_register_count > 0)
-       store_vfp_regs (regcache);
+       store_vfp_regs (regcache, ptid);
       if (tdep->have_fpa_registers)
-       store_fpregs (regcache);
+       store_fpregs (regcache, ptid);
     }
   else
     {
       if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
-       store_regs (regcache);
+       store_regs (regcache, ptid);
       else if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM))
-       store_fpregs (regcache);
+       store_fpregs (regcache, ptid);
       else if (tdep->have_wmmx_registers
               && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
-       store_wmmx_regs (regcache);
+       store_wmmx_regs (regcache, ptid);
       else if (tdep->vfp_register_count > 0
               && regno >= ARM_D0_REGNUM
               && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
-       store_vfp_regs (regcache);
+       store_vfp_regs (regcache, ptid);
     }
 }
 
index 8857e37ce0199f66edb475b875afffea43879db5..f59e5645b781745bda6c4c88355408e5d38734e3 100644 (file)
@@ -211,13 +211,13 @@ armnbsd_fetch_registers (struct target_ops *ops,
 
 
 static void
-store_register (const struct regcache *regcache, int regno)
+store_register (const struct regcache *regcache, ptid_t ptid, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   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)
@@ -280,7 +280,7 @@ store_register (const struct regcache *regcache, int regno)
       break;
     }
 
-  ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+  ret = ptrace (PT_SETREGS, ptid_get_pid (ptid),
                (PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -328,7 +328,7 @@ store_regs (const struct regcache *regcache)
       inferior_registers.r_pc = pc_val | psr_val;
     }
 
-  ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+  ret = ptrace (PT_SETREGS, ptid_get_pid (ptid),
                (PTRACE_TYPE_ARG3) &inferior_registers, 0);
 
   if (ret < 0)
@@ -336,12 +336,12 @@ store_regs (const struct regcache *regcache)
 }
 
 static void
-store_fp_register (const struct regcache *regcache, int regno)
+store_fp_register (const 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)
@@ -363,7 +363,7 @@ store_fp_register (const struct regcache *regcache, int regno)
       break;
     }
 
-  ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+  ret = ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
                (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -371,7 +371,7 @@ store_fp_register (const struct regcache *regcache, int regno)
 }
 
 static void
-store_fp_regs (const struct regcache *regcache)
+store_fp_regs (const struct regcache *regcache, ptid_t ptid)
 {
   struct fpreg inferior_fp_registers;
   int ret;
@@ -385,7 +385,7 @@ store_fp_regs (const struct regcache *regcache)
   regcache_raw_collect (regcache, ARM_FPS_REGNUM,
                        (char *) &inferior_fp_registers.fpr_fpsr);
 
-  ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+  ret = ptrace (PT_SETFPREGS, ptid_get_pid (ptid),
                (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
 
   if (ret < 0)
@@ -394,19 +394,20 @@ store_fp_regs (const struct regcache *regcache)
 
 static void
 armnbsd_store_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)
-       store_register (regcache, regno);
+       store_register (regcache, regno, ptid);
       else
-       store_fp_register (regcache, regno);
+       store_fp_register (regcache, regno, ptid);
     }
   else
     {
-      store_regs (regcache);
-      store_fp_regs (regcache);
+      store_regs (regcache, ptid);
+      store_fp_regs (regcache, ptid);
     }
 }
 
index c2c9866cd03ba2a5e0b326f76a4e5019f74f6634..04bd43bc6aff0d4a9ee5de8a49e7b03a4b94ac1f 100644 (file)
@@ -309,13 +309,13 @@ bsd_uthread_fetch_registers (struct target_ops *ops, struct regcache *regcache,
 
 static void
 bsd_uthread_store_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 bsd_uthread_ops *uthread_ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
   struct target_ops *beneath = find_target_beneath (ops);
-  ptid_t ptid = inferior_ptid;
   CORE_ADDR addr = ptid_get_tid (ptid);
   CORE_ADDR active_addr;
 
@@ -330,7 +330,7 @@ bsd_uthread_store_registers (struct target_ops *ops,
     {
       /* Updating the thread that is currently running; pass the
          request to the layer beneath.  */
-      beneath->to_store_registers (beneath, regcache, regnum);
+      beneath->to_store_registers (beneath, regcache, ptid, regnum);
     }
 }
 
index da1f914dd9e5d4128402aabc7ef2258174bb3946..ff283138402ec9348b131e2f929a6e9a0191d4ee 100644 (file)
@@ -240,7 +240,7 @@ fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
 /* Store one register.  */
 
 static void
-store_register (const struct regcache *regcache, int regno)
+store_register (const struct regcache *regcache, ptid_t ptid, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int tid;
@@ -250,9 +250,9 @@ store_register (const struct regcache *regcache, int 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.  */
 
   errno = 0;
   regcache_raw_collect (regcache, regno, &val);
@@ -291,18 +291,19 @@ hppa_linux_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 hppa_linux_store_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++)
-       store_register (regcache, regno);
+       store_register (regcache, regno, ptid);
     }
   else
     {
-      store_register (regcache, regno);
+      store_register (regcache, regno, ptid);
     }
 }
 
index 7602f8052924829e6e46f15b9009c590ba2446c2..94f6809eb9bb8a9546ed4d538692bbaf742344c1 100644 (file)
@@ -123,7 +123,7 @@ fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
 /* Store one register.  */
 
 static void
-store_register (const struct regcache *regcache, int regno)
+store_register (const struct regcache *regcache, ptid_t ptid, int regno)
 {
   int tid;
   int val;
@@ -133,9 +133,9 @@ store_register (const struct regcache *regcache, int 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.  */
 
   errno = 0;
   regcache_raw_collect (regcache, regno, &val);
@@ -535,7 +535,8 @@ i386_linux_fetch_inferior_registers (struct target_ops *ops,
    registers).  */
 static void
 i386_linux_store_inferior_registers (struct target_ops *ops,
-                                    struct regcache *regcache, int regno)
+                                    struct regcache *regcache,
+                                    ptid_t ptid, int regno)
 {
   int tid;
 
@@ -547,15 +548,15 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
 
       for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
        if (regno == -1 || regno == i)
-         store_register (regcache, i);
+         store_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_SETFPXREGS requests whenever possible, since it
      transfers more registers in one system call.  But remember that
index da3fdaecf6932cc4c2606630152f45a0b6f594ab..7c00c5b51fbcda143dcd93c7ee581beafc481def 100644 (file)
@@ -783,7 +783,8 @@ ia64_linux_fetch_registers (struct target_ops *ops,
 /* Store register REGNUM into the inferior.  */
 
 static void
-ia64_linux_store_register (const struct regcache *regcache, int regnum)
+ia64_linux_store_register (const struct regcache *regcache,
+                          ptid_t ptid, int regnum)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
@@ -796,9 +797,9 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
 
   /* 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);
@@ -827,15 +828,16 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
 
 static void
 ia64_linux_store_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_store_register (regcache, regnum);
+      ia64_linux_store_register (regcache, ptid, regnum);
   else
-    ia64_linux_store_register (regcache, regnum);
+    ia64_linux_store_register (regcache, ptid, regnum);
 }
 
 
index 49445dd6888765f3f041627ef968f5d8eb73a2e8..0f128c4905ea309c34010e60001c8e319bc39b74 100644 (file)
@@ -91,7 +91,8 @@ inf_child_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 inf_child_store_inferior_registers (struct target_ops *ops,
-                                   struct regcache *regcache, int regnum)
+                                   struct regcache *regcache,
+                                   ptid_t ptid, int regnum)
 {
 }
 
index 3cc6a133fd968fa29f1aebc94cf48c6cf0affb5e..cf9cf5e93e6583f559577c7086197c44a6494fb9 100644 (file)
@@ -767,7 +767,8 @@ inf_ptrace_fetch_registers (struct target_ops *ops, struct regcache *regcache,
 /* Store register REGNUM into the inferior.  */
 
 static void
-inf_ptrace_store_register (const struct regcache *regcache, int regnum)
+inf_ptrace_store_register (const struct regcache *regcache,
+                          ptid_t ptid, int regnum)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
@@ -783,9 +784,9 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
 
   /* 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);
@@ -811,15 +812,16 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
 
 static void
 inf_ptrace_store_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++)
-      inf_ptrace_store_register (regcache, regnum);
+      inf_ptrace_store_register (regcache, ptid, regnum);
   else
-    inf_ptrace_store_register (regcache, regnum);
+    inf_ptrace_store_register (regcache, ptid, regnum);
 }
 
 /* Create a "traditional" ptrace target.  REGISTER_U_OFFSET should be
index d7403e5e72aadbf373eef170738ecfd12bbb23fa..b39459df28d2488a098a851a884d0a6c5fa4d6ee 100644 (file)
@@ -154,7 +154,7 @@ old_fetch_inferior_registers (struct regcache *regcache, ptid_t ptid, int regno)
 /* Store one register.  */
 
 static void
-store_register (const struct regcache *regcache, int regno)
+store_register (const struct regcache *regcache, ptid_t ptid, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   long regaddr, val;
@@ -163,9 +163,9 @@ store_register (const struct regcache *regcache, int regno)
   gdb_byte buf[M68K_MAX_REGISTER_SIZE];
 
   /* 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];
@@ -192,11 +192,12 @@ store_register (const struct regcache *regcache, int regno)
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 static void
-old_store_inferior_registers (const struct regcache *regcache, int regno)
+old_store_inferior_registers (const struct regcache *regcache,
+                             ptid_t ptid, int regno)
 {
   if (regno >= 0)
     {
-      store_register (regcache, regno);
+      store_register (regcache, ptid, regno);
     }
   else
     {
@@ -204,7 +205,7 @@ old_store_inferior_registers (const struct regcache *regcache, int regno)
           regno < gdbarch_num_regs (get_regcache_arch (regcache));
           regno++)
        {
-         store_register (regcache, regno);
+         store_register (regcache, ptid, regno);
        }
     }
 }
@@ -462,7 +463,8 @@ m68k_linux_fetch_inferior_registers (struct target_ops *ops,
    registers).  */
 static void
 m68k_linux_store_inferior_registers (struct target_ops *ops,
-                                    struct regcache *regcache, int regno)
+                                    struct regcache *regcache,
+                                    ptid_t ptid, int regno)
 {
   int tid;
 
@@ -470,14 +472,14 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
      SETREGS request isn't available.  */
   if (! have_ptrace_getregs)
     {
-      old_store_inferior_registers (regcache, regno);
+      old_store_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_SETFPREGS requests whenever possible, since it
      transfers more registers in one system call.  But remember that
index f9b6e1b2fc4c00a919a403a02af99d963d815077..8456cc0e9be1696d3cefed9cd6f9e78a2c76b878 100644 (file)
@@ -56,7 +56,7 @@ static int have_ptrace_regsets = 1;
 static void (*super_fetch_registers) (struct target_ops *,
                                      struct regcache *, ptid_t, int);
 static void (*super_store_registers) (struct target_ops *,
-                                     struct regcache *, int);
+                                     struct regcache *, ptid_t, int);
 
 static void (*super_close) (struct target_ops *);
 
@@ -304,7 +304,8 @@ mips64_linux_regsets_fetch_registers (struct target_ops *ops,
 
 static void
 mips64_linux_regsets_store_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;
@@ -334,9 +335,9 @@ mips64_linux_regsets_store_registers (struct target_ops *ops,
   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))
     {
@@ -367,14 +368,14 @@ mips64_linux_regsets_store_registers (struct target_ops *ops,
     }
 
   if (is_dsp)
-    super_store_registers (ops, regcache, regno);
+    super_store_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_store_registers (ops, regcache, regi);
-      super_store_registers (ops, regcache, mips_regnum (gdbarch)->dspctl);
+       super_store_registers (ops, regcache, ptid, regi);
+      super_store_registers (ops, regcache, ptid, mips_regnum (gdbarch)->dspctl);
     }
 }
 
@@ -401,16 +402,17 @@ mips64_linux_fetch_registers (struct target_ops *ops,
 
 static void
 mips64_linux_store_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_store_registers (ops, regcache, regnum);
+    mips64_linux_regsets_store_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_store_registers (ops, regcache, regnum);
+    super_store_registers (ops, regcache, ptid, regnum);
 }
 
 /* Return the address in the core dump or inferior of register
index e7070ccd37884398a922fb221ca486a1159666ce..a35e06864e9ec320be408e65cf156a7eb99e5351 100644 (file)
@@ -2290,14 +2290,15 @@ ppc_linux_masked_watch_num_registers (struct target_ops *target,
 
 static void
 ppc_linux_store_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 >= 0)
     store_register (regcache, tid, regno);
index f2b837b3c00658574bdf55a755434953b77cc09d..13a63829565a52a2f41e7fd02c1e8fa4442e9b44 100644 (file)
@@ -110,7 +110,8 @@ ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 ppcnbsd_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);
 
@@ -118,14 +119,14 @@ ppcnbsd_store_inferior_registers (struct target_ops *ops,
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+      if (ptrace (PT_GETREGS, ptid_get_pid (ptid),
                  (PTRACE_TYPE_ARG3) &regs, 0) == -1)
        perror_with_name (_("Couldn't get registers"));
 
       ppc_collect_gregset (&ppcnbsd_gregset, regcache,
                           regnum, &regs, sizeof regs);
 
-      if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+      if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
                  (PTRACE_TYPE_ARG3) &regs, 0) == -1)
        perror_with_name (_("Couldn't write registers"));
     }
@@ -134,14 +135,14 @@ ppcnbsd_store_inferior_registers (struct target_ops *ops,
     {
       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"));
 
       ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
                            regnum, &fpregs, sizeof fpregs);
 
-      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 set FP registers"));
     }
index 0bb6f9f5d26b7762173973e5d49654b3558cfc8d..09a6acedcde8061cd805dfad0d6d2e535cd06ed1 100644 (file)
@@ -109,11 +109,12 @@ ppcobsd_fetch_registers (struct target_ops *ops,
 
 static void
 ppcobsd_store_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) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
 
@@ -124,7 +125,7 @@ ppcobsd_store_registers (struct target_ops *ops,
                        regnum, &regs, sizeof regs);
 #endif
 
-  if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+  if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
              (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't write registers"));
 
@@ -134,14 +135,14 @@ ppcobsd_store_registers (struct target_ops *ops,
     {
       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"));
 
       ppc_collect_fpregset (&ppcobsd_fpregset, regcache,
                            regnum, &fpregs, sizeof fpregs);
 
-      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"));
     }
index 9f518c2b535daae3b1ecfabfbcf9a598693a7c70..1e4eb03cf14a358b254dd3de156edfb5567cdfc6 100644 (file)
@@ -184,7 +184,7 @@ ppc_ravenscar_generic_prepare_to_store (struct regcache *regcache)
 static void
 ppc_ravenscar_generic_store_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);
   int buf_size = register_size (gdbarch, regnum);
@@ -193,7 +193,7 @@ ppc_ravenscar_generic_store_registers
 
   if (register_in_thread_descriptor_p (reg_info, regnum))
     register_address
-      = ptid_get_tid (inferior_ptid) + reg_info->context_offsets [regnum];
+      = ptid_get_tid (ptid) + reg_info->context_offsets [regnum];
   else
     return;
 
@@ -225,9 +225,10 @@ ppc_ravenscar_powerpc_fetch_registers (struct regcache *regcache, ptid_t ptid,
    for most PowerPC targets.  */
 
 static void
-ppc_ravenscar_powerpc_store_registers (struct regcache *regcache, int regnum)
+ppc_ravenscar_powerpc_store_registers (struct regcache *regcache, ptid_t ptid,
+                                      int regnum)
 {
-  ppc_ravenscar_generic_store_registers (&ppc_reg_info, regcache, regnum);
+  ppc_ravenscar_generic_store_registers (&ppc_reg_info, regcache, ptid, regnum);
 }
 
 /* The ravenscar_arch_ops vector for most PowerPC targets.  */
@@ -270,9 +271,11 @@ ppc_ravenscar_e500_fetch_registers (struct regcache *regcache, ptid_t ptid,
    for E500 targets.  */
 
 static void
-ppc_ravenscar_e500_store_registers (struct regcache *regcache, int regnum)
+ppc_ravenscar_e500_store_registers (struct regcache *regcache, ptid_t ptid,
+                                   int regnum)
 {
-  ppc_ravenscar_generic_store_registers (&e500_reg_info, regcache, regnum);
+  ppc_ravenscar_generic_store_registers (&e500_reg_info, regcache, ptid,
+                                        regnum);
 }
 
 /* The ravenscar_arch_ops vector for E500 targets.  */
index 188ad5515737a67612f9a563552913d118ee09a1..373c762cb409d0fd1c8b8c44eac9d6efa0a7a74d 100644 (file)
@@ -174,16 +174,13 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
 ps_err_e
 ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const 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 ());
-
+  regcache = get_thread_arch_regcache (ptid, target_gdbarch ());
   supply_gregset (regcache, (const gdb_gregset_t *) gregset);
-  target_store_registers (regcache, -1);
+  target_store_registers (regcache, ptid, -1);
 
-  do_cleanups (old_chain);
   return PS_OK;
 }
 
@@ -211,16 +208,13 @@ ps_err_e
 ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
               const 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 ());
-
+  regcache = get_thread_arch_regcache (ptid, target_gdbarch ());
   supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
-  target_store_registers (regcache, -1);
+  target_store_registers (regcache, ptid, -1);
 
-  do_cleanups (old_chain);
   return PS_OK;
 }
 
index c7b7dab1d43bfc404b41b0c143295bd7d8b5cb93..e98f68aef9124d3f9579af659ccd94c8dff89ab5 100644 (file)
@@ -117,7 +117,7 @@ static void procfs_files_info (struct target_ops *);
 static void procfs_fetch_registers (struct target_ops *,
                                    struct regcache *, ptid_t, int);
 static void procfs_store_registers (struct target_ops *,
-                                   struct regcache *, int);
+                                   struct regcache *, ptid_t, int);
 static void procfs_pass_signals (struct target_ops *self,
                                 int, unsigned char *);
 static void procfs_kill_inferior (struct target_ops *ops);
@@ -3265,19 +3265,20 @@ procfs_fetch_registers (struct target_ops *ops,
 
 static void
 procfs_store_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: store_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)
index 12a4eab26914bdddae5c37d1bc954a63a7b058d6..0660d03a5ea1be2a90b474b874381659b3b8effd 100644 (file)
@@ -57,8 +57,6 @@ static ptid_t ravenscar_running_thread (void);
 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_store_registers (struct target_ops *ops,
-                                       struct regcache *regcache, int regnum);
 static void ravenscar_prepare_to_store (struct target_ops *self,
                                        struct regcache *regcache);
 static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
@@ -283,21 +281,22 @@ ravenscar_fetch_registers (struct target_ops *ops, struct regcache *regcache,
 
 static void
 ravenscar_store_registers (struct target_ops *ops,
-                           struct regcache *regcache, int regnum)
+                           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_store_registers (beneath, regcache, regnum);
+      || ptid_equal (ptid, base_magic_null_ptid)
+      || ptid_equal (ptid, ravenscar_running_thread ()))
+    beneath->to_store_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_store_registers (regcache, regnum);
+      arch_ops->to_store_registers (regcache, ptid, regnum);
     }
 }
 
index 2413153010eb9f89ba843a5e126dd5e8777b876f..2df88981a573fa405541aa1eeb66b4fc7c09b5ae 100644 (file)
@@ -25,7 +25,7 @@
 struct ravenscar_arch_ops
 {
   void (*to_fetch_registers) (struct regcache *, ptid_t, int);
-  void (*to_store_registers) (struct regcache *, int);
+  void (*to_store_registers) (struct regcache *, ptid_t, int);
   void (*to_prepare_to_store) (struct regcache *);
 };
 
index 3f6cc859474806974669d1991c77ac73c2bceb39..6c16148a252c462d4c88b96e16f07ed490fe3817 100644 (file)
@@ -1462,18 +1462,19 @@ record_btrace_fetch_registers (struct target_ops *ops,
 
 static void
 record_btrace_store_registers (struct target_ops *ops,
-                              struct regcache *regcache, int regno)
+                              struct regcache *regcache,
+                              ptid_t ptid, int regno)
 {
   struct target_ops *t;
 
   if (!record_btrace_generating_corefile
-      && record_btrace_is_replaying (ops, inferior_ptid))
+      && record_btrace_is_replaying (ops, ptid))
     error (_("Cannot write registers while replaying."));
 
   gdb_assert (may_write_registers != 0);
 
   t = ops->beneath;
-  t->to_store_registers (t, regcache, regno);
+  t->to_store_registers (t, regcache, ptid, regno);
 }
 
 /* The to_prepare_to_store method of target record-btrace.  */
index 0b04f0fbb73c868199eba68303c7a1101eea6433..c55fb41b0142df641d0b44c01ebc48fb094b1338 100644 (file)
@@ -1459,7 +1459,7 @@ record_full_registers_change (struct regcache *regcache, int regnum)
 static void
 record_full_store_registers (struct target_ops *ops,
                             struct regcache *regcache,
-                            int regno)
+                            ptid_t ptid, int regno)
 {
   if (!record_full_gdb_operation_disable)
     {
@@ -1507,7 +1507,7 @@ record_full_store_registers (struct target_ops *ops,
 
       record_full_registers_change (regcache, regno);
     }
-  ops->beneath->to_store_registers (ops->beneath, regcache, regno);
+  ops->beneath->to_store_registers (ops->beneath, regcache, ptid, regno);
 }
 
 /* "to_xfer_partial" method.  Behavior is conditional on
@@ -2074,7 +2074,7 @@ record_full_core_prepare_to_store (struct target_ops *self,
 static void
 record_full_core_store_registers (struct target_ops *ops,
                              struct regcache *regcache,
-                             int regno)
+                            ptid_t ptid, int regno)
 {
   if (record_full_gdb_operation_disable)
     regcache_raw_collect (regcache, regno,
index bdf0bcbc82c08d89bf84bf3c0d260d96ee5ba076..c8eb200fa271ff759b9e996db3308e0b407c36c2 100644 (file)
@@ -957,7 +957,7 @@ regcache_raw_write (struct regcache *regcache, int regnum,
   chain_before_invalidate_register
     = make_cleanup_regcache_invalidate (regcache, regnum);
 
-  target_store_registers (regcache, regnum);
+  target_store_registers (regcache, regcache->ptid, regnum);
 
   /* The target did not throw an error so we can discard invalidating the
      register and restore the cleanup chain to what it was.  */
index 609ae84faca369315ded9de747355002d49f994c..b7ecdbb05f338aa7aebd2124b1c22a46b6423f17 100644 (file)
@@ -504,16 +504,18 @@ gdbsim_fetch_register (struct target_ops *ops,
 
 static void
 gdbsim_store_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_store_register (ops, regcache, regno);
+       gdbsim_store_register (ops, regcache, ptid, regno);
       return;
     }
   else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0)
index b1b1c580386c29027635d70f93e3c0822f387833..b7ffa4a28fbfad19e4c10892c4278f3a2d018e2d 100644 (file)
@@ -7862,13 +7862,14 @@ store_registers_using_G (const struct regcache *regcache)
 
 static void
 remote_store_registers (struct target_ops *ops,
-                       struct regcache *regcache, int regnum)
+                       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)
     {
index 9841a60eafb0381cd2343dd3a8d5745571f5460e..3cd0350e1469ce0e824a3b5f629b7baf6d7987f4 100644 (file)
@@ -37,6 +37,7 @@
 #include "solib.h"
 #include "solib-aix.h"
 #include "xml-utils.h"
+#include "inferior.h"
 
 /* If the kernel has to deliver a signal, it pushes a sigcontext
    structure on the stack and then calls the signal handler, passing
@@ -407,7 +408,7 @@ ran_out_of_registers_for_arguments:
   regcache_raw_write_signed (regcache, tdep->ppc_toc_regnum,
                             solib_aix_get_toc_value (func_addr));
 
-  target_store_registers (regcache, -1);
+  target_store_registers (regcache, inferior_ptid, -1);
   return sp;
 }
 
index f2aa1f8448cf487b1522df89ef42a3937799d95f..600084f546667f21c5eeeefd2194caf677c77e41 100644 (file)
@@ -24,6 +24,7 @@
 #include "ppc-tdep.h"
 #include "value.h"
 #include "xcoffread.h"
+#include "inferior.h"
 
 /* Implement the "push_dummy_call" gdbarch method.  */
 
@@ -256,7 +257,7 @@ ran_out_of_registers_for_arguments:
      breakpoint.  */
   regcache_raw_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
 
-  target_store_registers (regcache, -1);
+  target_store_registers (regcache, inferior_ptid, -1);
   return sp;
 }
 
index 7362df9580d5538fa3eb73b0bcf5f65004941ec3..6f3f80763770a7330d37be3c85971c9d3fd2c41a 100644 (file)
@@ -219,7 +219,7 @@ fetch_register (struct regcache *regcache, ptid_t ptid, int regno)
 /* Store register REGNO back into the inferior.  */
 
 static void
-store_register (struct regcache *regcache, int regno)
+store_register (struct regcache *regcache, ptid_t ptid, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int addr[MAX_REGISTER_SIZE];
@@ -235,7 +235,7 @@ store_register (struct regcache *regcache, int regno)
 
   /* Floating-point registers.  */
   if (isfloat)
-    rs6000_ptrace32 (PT_WRITE_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
+    rs6000_ptrace32 (PT_WRITE_FPR, ptid_get_pid (ptid), addr, nr, 0);
 
   /* Bogus register number.  */
   else if (nr < 0)
@@ -253,7 +253,7 @@ store_register (struct regcache *regcache, int regno)
          the register's value is passed by value, but for 64-bit inferiors,
         the address of a buffer containing the value is passed.  */
       if (!ARCH64 ())
-       rs6000_ptrace32 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
+       rs6000_ptrace32 (PT_WRITE_GPR, ptid_get_pid (ptid),
                         (int *) nr, *addr, 0);
       else
        {
@@ -264,7 +264,7 @@ store_register (struct regcache *regcache, int regno)
            memcpy (&buf, addr, 8);
          else
            buf = *addr;
-         rs6000_ptrace64 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
+         rs6000_ptrace64 (PT_WRITE_GPR, ptid_get_pid (ptid),
                           nr, 0, &buf);
        }
     }
@@ -325,11 +325,12 @@ rs6000_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 rs6000_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)
-    store_register (regcache, regno);
+    store_register (regcache, ptid, regno);
 
   else
     {
@@ -340,25 +341,25 @@ rs6000_store_inferior_registers (struct target_ops *ops,
            regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
           regno++)
        {
-         store_register (regcache, regno);
+         store_register (regcache, ptid, regno);
        }
 
       /* Write floating point registers.  */
       if (tdep->ppc_fp0_regnum >= 0)
         for (regno = 0; regno < ppc_num_fprs; regno++)
-          store_register (regcache, tdep->ppc_fp0_regnum + regno);
+          store_register (regcache, ptid, tdep->ppc_fp0_regnum + regno);
 
       /* Write special registers.  */
-      store_register (regcache, gdbarch_pc_regnum (gdbarch));
-      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);
+      store_register (regcache, ptid, gdbarch_pc_regnum (gdbarch));
+      store_register (regcache, ptid, tdep->ppc_ps_regnum);
+      store_register (regcache, ptid, tdep->ppc_cr_regnum);
+      store_register (regcache, ptid, tdep->ppc_lr_regnum);
+      store_register (regcache, ptid, tdep->ppc_ctr_regnum);
+      store_register (regcache, ptid, tdep->ppc_xer_regnum);
       if (tdep->ppc_fpscr_regnum >= 0)
-        store_register (regcache, tdep->ppc_fpscr_regnum);
+        store_register (regcache, ptid, tdep->ppc_fpscr_regnum);
       if (tdep->ppc_mq_regnum >= 0)
-       store_register (regcache, tdep->ppc_mq_regnum);
+       store_register (regcache, ptid, tdep->ppc_mq_regnum);
     }
 }
 
index 1703844e0858d5d2c6be82b4e86f1069a3c96279..15fab438a3564713dd470507e1c412250e533497 100644 (file)
@@ -420,9 +420,10 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops,
    -1, do this for all registers.  */
 static void
 s390_linux_store_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))
     store_regs (regcache, tid, regnum);
index d1ece86cddda17b00c5832258fde006597b46e82..4d1794f80630315eeb4d7bdc5267f039cd581301 100644 (file)
@@ -65,13 +65,14 @@ shnbsd_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 shnbsd_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 (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"));
 
@@ -79,7 +80,7 @@ shnbsd_store_inferior_registers (struct target_ops *ops,
                                  (char *) &inferior_registers,
                                  SHNBSD_SIZEOF_GREGS);
 
-      if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+      if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
                  (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
        perror_with_name (_("Couldn't set registers"));
 
index 56fdc963802a9947741bc8564ace17743e0db737..bd20cba48007539fa33626c9eaf02ee2ff097ce5 100644 (file)
@@ -508,7 +508,8 @@ sol_thread_fetch_registers (struct target_ops *ops,
 
 static void
 sol_thread_store_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;
@@ -516,17 +517,17 @@ sol_thread_store_registers (struct target_ops *ops,
   prgregset_t gregset;
   prfpregset_t fpregset;
 
-  if (!ptid_tid_p (inferior_ptid))
+  if (!ptid_tid_p (ptid))
     {
       struct target_ops *beneath = find_target_beneath (ops);
 
       /* It's an LWP; pass the request on to the layer beneath.  */
-      beneath->to_store_registers (beneath, regcache, regnum);
+      beneath->to_store_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);
 
   val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
   if (val != TD_OK)
index b423ce5c403a7b946ea0d884f98fa8fcb0bcd404..f0bcc131dcf98008416b64eddc2153e970ac138b 100644 (file)
@@ -191,16 +191,17 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
 
 void
 sparc_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);
   int pid;
 
   /* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
      about threaded assumptions.  */
-  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 == -1 || sparc_gregset_supplies_p (gdbarch, regnum))
     {
index bfa6961fe988831a0844227f0c27b6f9d9c102b1..4ab8130403714494166f503cde9cbf130eda104a 100644 (file)
@@ -47,6 +47,6 @@ extern struct target_ops *sparc_target (void);
 extern void sparc_fetch_inferior_registers (struct target_ops *,
                                            struct regcache *, ptid_t, int);
 extern void sparc_store_inferior_registers (struct target_ops *,
-                                           struct regcache *, int);
+                                           struct regcache *, ptid_t, int);
 
 #endif /* sparc-nat.h */
index 0573f8345d4dfcb1aa8c1b58886e07a1b212cf59..4e63ec5a3c464b20d1dc76a3109a7c3993aba168 100644 (file)
@@ -25,8 +25,6 @@
 #include "ravenscar-thread.h"
 #include "sparc-ravenscar-thread.h"
 
-static void sparc_ravenscar_store_registers (struct regcache *regcache,
-                                             int regnum);
 static void sparc_ravenscar_prepare_to_store (struct regcache *regcache);
 
 /* Register offsets from a referenced address (exempli gratia the
@@ -152,7 +150,8 @@ sparc_ravenscar_prepare_to_store (struct regcache *regcache)
    thread.  */
 
 static void
-sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
+sparc_ravenscar_store_registers (struct regcache *regcache, ptid_t ptid,
+                                int regnum)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int buf_size = register_size (gdbarch, regnum);
@@ -160,8 +159,7 @@ sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
   ULONGEST register_address;
 
   if (register_in_thread_descriptor_p (regnum))
-    register_address =
-      ptid_get_tid (inferior_ptid) + sparc_register_offsets [regnum];
+    register_address = ptid_get_tid (ptid) + sparc_register_offsets [regnum];
   else if (register_on_stack_p (regnum))
     {
       regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,
index c5b91222c14c945f04a8989cf1657fb8d2cc6c5f..a0b28219cf26744bbd88a512d11c5cfcd2055eef 100644 (file)
@@ -534,7 +534,8 @@ spu_fetch_inferior_registers (struct target_ops *ops,
 /* Override the store_inferior_register routine.  */
 static void
 spu_store_inferior_registers (struct target_ops *ops,
-                             struct regcache *regcache, int regno)
+                             struct regcache *regcache,
+                             ptid_t ptid, int regno)
 {
   int fd;
   ULONGEST addr;
index 6516a10b76d1c9ca4b69a5f7318afec5ea01f27a..a07909885ea01be1e067c55a040c3935ee3242ad 100644 (file)
@@ -196,7 +196,7 @@ spu_fetch_registers (struct target_ops *ops, struct regcache *regcache,
 /* Override the to_store_registers routine.  */
 static void
 spu_store_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 target_ops *ops_beneath = find_target_beneath (ops);
@@ -206,12 +206,12 @@ spu_store_registers (struct target_ops *ops,
   /* This version applies only if we're currently in spu_run.  */
   if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
     {
-      ops_beneath->to_store_registers (ops_beneath, regcache, regno);
+      ops_beneath->to_store_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 NPC register is found in PPC memory at SPUFS_ADDR.  */
index 01ab150e3a0d1eb94c0d27aee853c2f5753268b8..3f1c236d8f30ac72ee5bef2d97786f132cf630ed 100644 (file)
@@ -187,29 +187,31 @@ debug_fetch_registers (struct target_ops *self, struct regcache *arg1, ptid_t ar
 }
 
 static void
-delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+delegate_store_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
 {
   self = self->beneath;
-  self->to_store_registers (self, arg1, arg2);
+  self->to_store_registers (self, arg1, arg2, arg3);
 }
 
 static void
-tdefault_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+tdefault_store_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
 {
   noprocess ();
 }
 
 static void
-debug_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+debug_store_registers (struct target_ops *self, struct regcache *arg1, ptid_t arg2, int arg3)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_store_registers (...)\n", debug_target.to_shortname);
-  debug_target.to_store_registers (&debug_target, arg1, arg2);
+  debug_target.to_store_registers (&debug_target, arg1, arg2, arg3);
   fprintf_unfiltered (gdb_stdlog, "<- %s->to_store_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);
 }
 
index e57789f15f37a916d504be84af2df55c92155766..6ce0921ac0af4c978f61ec86334d39968eb85c5a 100644 (file)
@@ -3593,12 +3593,12 @@ target_fetch_registers (struct regcache *regcache, ptid_t ptid, int regno)
 }
 
 void
-target_store_registers (struct regcache *regcache, int regno)
+target_store_registers (struct regcache *regcache, ptid_t ptid, int regno)
 {
   if (!may_write_registers)
     error (_("Writing to registers is not allowed (regno %d)"), regno);
 
-  current_target.to_store_registers (&current_target, regcache, regno);
+  current_target.to_store_registers (&current_target, regcache, ptid, regno);
   if (targetdebug)
     {
       debug_print_register ("target_store_registers", regcache, regno);
index 24a138ff67c729a9079a442d5764d141567880f9..d6c07ad44d874c1fac3773bcb826fd32ff451898 100644 (file)
@@ -471,7 +471,8 @@ struct target_ops
     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)
+    void (*to_store_registers) (struct target_ops *, struct regcache *, ptid_t,
+                               int)
       TARGET_DEFAULT_NORETURN (noprocess ());
     void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
       TARGET_DEFAULT_NORETURN (noprocess ());
@@ -1391,7 +1392,8 @@ extern void target_fetch_registers (struct regcache *regcache, ptid_t ptid,
    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.  */
 
-extern void target_store_registers (struct regcache *regcache, int regs);
+extern void target_store_registers (struct regcache *regcache, ptid_t ptid,
+                                   int regs);
 
 /* Get ready to modify the registers array.  On machines which store
    individual registers, this doesn't need to do anything.  On machines
index 5c47a3e0756857070fec1f0981487f0e3f6dc73c..f3e747b57093bf3f30f3268fc55aa053ef507efd 100644 (file)
@@ -144,14 +144,15 @@ fetch_inferior_registers (struct target_ops *ops,
 
 static void
 store_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) &regs) < 0)
     perror_with_name (_("Couldn't get registers"));
index 8d1cdf485652fabd1197880e5bdbdeb4482681c8..dfc8c8c7386c3f665de68ef628fc5689101d54f1 100644 (file)
@@ -81,17 +81,18 @@ vaxbsd_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 vaxbsd_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) &regs, 0) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   vaxbsd_collect_gregset (regcache, &regs, regnum);
 
-  if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+  if (ptrace (PT_SETREGS, ptid_get_pid (ptid),
              (PTRACE_TYPE_ARG3) &regs, 0) == -1)
     perror_with_name (_("Couldn't write registers"));
 }
index 36ca90d36c3e69c9f22c6eef39a4764b405fdf7e..2fa772a2baf17ed51753dec909de98fecfa477a1 100644 (file)
@@ -559,9 +559,10 @@ do_windows_store_inferior_registers (const struct regcache *regcache,
 /* Store a new register value into the current thread context.  */
 static void
 windows_store_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.  */
index 688ed5c7d6f71619973b508b0cd4f2d744f187e7..467c24968ab53becf607e218fdf8946e3f6eb00e 100644 (file)
@@ -187,13 +187,13 @@ fetch_gregs (struct regcache *regcache, ptid_t ptid, int regnum)
   supply_gregset_reg (regcache, &regs, regnum);
 }
 
-/* Store greg-register(s) in GDB's register 
-   array into the process/thread specified by TID.  */
+/* Store greg-register(s) in REGCACHE into the process/thread specified by
+   PTID.  */
 
 static void
-store_gregs (struct regcache *regcache, int regnum)
+store_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;
 
@@ -235,9 +235,9 @@ fetch_xtregs (struct regcache *regcache, ptid_t ptid, int regnum)
 }
 
 static void
-store_xtregs (struct regcache *regcache, int regnum)
+store_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];
 
@@ -271,17 +271,18 @@ xtensa_linux_fetch_inferior_registers (struct target_ops *ops,
 
 static void
 xtensa_linux_store_inferior_registers (struct target_ops *ops,
-                                      struct regcache *regcache, int regnum)
+                                      struct regcache *regcache,
+                                      ptid_t ptid, int regnum)
 {
   if (regnum == -1)
     {
-      store_gregs (regcache, regnum);
-      store_xtregs (regcache, regnum);
+      store_gregs (regcache, ptid, regnum);
+      store_xtregs (regcache, ptid, regnum);
     }
   else if ((regnum < xtreg_lo) || (regnum > xtreg_high))
-    store_gregs (regcache, regnum);
+    store_gregs (regcache, ptid, regnum);
   else
-    store_xtregs (regcache, regnum);
+    store_xtregs (regcache, ptid, regnum);
 }
 
 /* Called by libthread_db.  */