Use ptid from regcache in almost all remaining nat files
This patch contains almost all of the remaining changes needed to make to_fetch_registers/to_store_registers/to_prepare_to_store independent of inferior_ptid. It contains only some "trivial" changes, the more complicated ones are in separate patches. gdb/ChangeLog: * i386-linux-nat.c (fetch_register, store_register, i386_linux_fetch_inferior_registers, i386_linux_store_inferior_registers): Use ptid from regcache. * ia64-linux-nat.c (ia64_linux_fetch_register, ia64_linux_store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register, inf_ptrace_store_register): Likewise. * m32r-linux-nat.c (m32r_linux_fetch_inferior_registers, m32r_linux_store_inferior_registers): Likewise. * m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers, m68kbsd_store_inferior_registers): Likewise. * m68k-linux-nat.c (fetch_register, store_register, m68k_linux_fetch_inferior_registers, m68k_linux_store_inferior_registers): Likewise. * m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers, m88kbsd_store_inferior_registers): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers, mips_fbsd_store_inferior_registers): Likewise. * mips-linux-nat.c (mips64_linux_regsets_fetch_registers, mips64_linux_regsets_store_registers): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers, mipsnbsd_store_inferior_registers): Likewise. * mips-obsd-nat.c (mips64obsd_fetch_inferior_registers, mips64obsd_store_inferior_registers): Likewise. * nto-procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers, ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (ppc_linux_fetch_inferior_registers, ppc_linux_store_inferior_registers): Likewise. * ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers, ppcnbsd_store_inferior_registers): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers, ppcobsd_store_registers): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers, ravenscar_store_registers, ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers, record_btrace_store_registers, record_btrace_prepare_to_store): Likewise. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Lookup inferior using ptid from regcache, instead of current_inferior. * remote.c (remote_fetch_registers, remote_store_registers): Use ptid from regcache. * rs6000-nat.c (fetch_register, store_register): Likewise. * s390-linux-nat.c (s390_linux_fetch_inferior_registers, s390_linux_store_inferior_registers): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Likewise. * sol-thread.c (sol_thread_fetch_registers, sol_thread_store_registers): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers, sparc_store_inferior_registers): Likewise. * tilegx-linux-nat.c (fetch_inferior_registers, store_inferior_registers): Likewise. * vax-bsd-nat.c (vaxbsd_fetch_inferior_registers, vaxbsd_store_inferior_registers): Likewise. * xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs, store_xtregs): Likewise.
This commit is contained in:
parent
c0f55cc689
commit
bcc0c096d5
30 changed files with 239 additions and 249 deletions
|
@ -1,3 +1,68 @@
|
||||||
|
2017-03-20 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* i386-linux-nat.c (fetch_register, store_register,
|
||||||
|
i386_linux_fetch_inferior_registers,
|
||||||
|
i386_linux_store_inferior_registers): Use ptid from regcache.
|
||||||
|
* ia64-linux-nat.c (ia64_linux_fetch_register,
|
||||||
|
ia64_linux_store_register): Likewise.
|
||||||
|
* inf-ptrace.c (inf_ptrace_fetch_register,
|
||||||
|
inf_ptrace_store_register): Likewise.
|
||||||
|
* m32r-linux-nat.c (m32r_linux_fetch_inferior_registers,
|
||||||
|
m32r_linux_store_inferior_registers): Likewise.
|
||||||
|
* m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers,
|
||||||
|
m68kbsd_store_inferior_registers): Likewise.
|
||||||
|
* m68k-linux-nat.c (fetch_register, store_register,
|
||||||
|
m68k_linux_fetch_inferior_registers,
|
||||||
|
m68k_linux_store_inferior_registers): Likewise.
|
||||||
|
* m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers,
|
||||||
|
m88kbsd_store_inferior_registers): Likewise.
|
||||||
|
* mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers,
|
||||||
|
mips_fbsd_store_inferior_registers): Likewise.
|
||||||
|
* mips-linux-nat.c (mips64_linux_regsets_fetch_registers,
|
||||||
|
mips64_linux_regsets_store_registers): Likewise.
|
||||||
|
* mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers,
|
||||||
|
mipsnbsd_store_inferior_registers): Likewise.
|
||||||
|
* mips-obsd-nat.c (mips64obsd_fetch_inferior_registers,
|
||||||
|
mips64obsd_store_inferior_registers): Likewise.
|
||||||
|
* nto-procfs.c (procfs_fetch_registers, procfs_store_registers):
|
||||||
|
Likewise.
|
||||||
|
* ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers,
|
||||||
|
ppcfbsd_store_inferior_registers): Likewise.
|
||||||
|
* ppc-linux-nat.c (ppc_linux_fetch_inferior_registers,
|
||||||
|
ppc_linux_store_inferior_registers): Likewise.
|
||||||
|
* ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers,
|
||||||
|
ppcnbsd_store_inferior_registers): Likewise.
|
||||||
|
* ppc-obsd-nat.c (ppcobsd_fetch_registers,
|
||||||
|
ppcobsd_store_registers): Likewise.
|
||||||
|
* procfs.c (procfs_fetch_registers, procfs_store_registers):
|
||||||
|
Likewise.
|
||||||
|
* ravenscar-thread.c (ravenscar_fetch_registers,
|
||||||
|
ravenscar_store_registers, ravenscar_prepare_to_store):
|
||||||
|
Likewise.
|
||||||
|
* record-btrace.c (record_btrace_fetch_registers,
|
||||||
|
record_btrace_store_registers, record_btrace_prepare_to_store):
|
||||||
|
Likewise.
|
||||||
|
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register):
|
||||||
|
Lookup inferior using ptid from regcache, instead of
|
||||||
|
current_inferior.
|
||||||
|
* remote.c (remote_fetch_registers, remote_store_registers): Use
|
||||||
|
ptid from regcache.
|
||||||
|
* rs6000-nat.c (fetch_register, store_register): Likewise.
|
||||||
|
* s390-linux-nat.c (s390_linux_fetch_inferior_registers,
|
||||||
|
s390_linux_store_inferior_registers): Likewise.
|
||||||
|
* sh-nbsd-nat.c (shnbsd_fetch_inferior_registers,
|
||||||
|
shnbsd_store_inferior_registers): Likewise.
|
||||||
|
* sol-thread.c (sol_thread_fetch_registers,
|
||||||
|
sol_thread_store_registers): Likewise.
|
||||||
|
* sparc-nat.c (sparc_fetch_inferior_registers,
|
||||||
|
sparc_store_inferior_registers): Likewise.
|
||||||
|
* tilegx-linux-nat.c (fetch_inferior_registers,
|
||||||
|
store_inferior_registers): Likewise.
|
||||||
|
* vax-bsd-nat.c (vaxbsd_fetch_inferior_registers,
|
||||||
|
vaxbsd_store_inferior_registers): Likewise.
|
||||||
|
* xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs,
|
||||||
|
store_xtregs): Likewise.
|
||||||
|
|
||||||
2017-03-20 Artemiy Volkov <artemiyv@acm.org>
|
2017-03-20 Artemiy Volkov <artemiyv@acm.org>
|
||||||
|
|
||||||
PR gdb/14441
|
PR gdb/14441
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "linux-nat.h"
|
#include "linux-nat.h"
|
||||||
#include "x86-linux-nat.h"
|
#include "x86-linux-nat.h"
|
||||||
#include "nat/linux-ptrace.h"
|
#include "nat/linux-ptrace.h"
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
/* The register sets used in GNU/Linux ELF core-dumps are identical to
|
/* The register sets used in GNU/Linux ELF core-dumps are identical to
|
||||||
the register sets in `struct user' that is used for a.out
|
the register sets in `struct user' that is used for a.out
|
||||||
|
@ -94,7 +95,7 @@ int have_ptrace_getfpxregs =
|
||||||
static void
|
static void
|
||||||
fetch_register (struct regcache *regcache, int regno)
|
fetch_register (struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
gdb_assert (!have_ptrace_getregs);
|
gdb_assert (!have_ptrace_getregs);
|
||||||
|
@ -104,10 +105,7 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = ptrace (PTRACE_PEEKUSER, tid,
|
val = ptrace (PTRACE_PEEKUSER, tid,
|
||||||
|
@ -125,17 +123,14 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
static void
|
static void
|
||||||
store_register (const struct regcache *regcache, int regno)
|
store_register (const struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
gdb_assert (!have_ptrace_getregs);
|
gdb_assert (!have_ptrace_getregs);
|
||||||
if (i386_linux_gregset_reg_offset[regno] == -1)
|
if (i386_linux_gregset_reg_offset[regno] == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
regcache_raw_collect (regcache, regno, &val);
|
regcache_raw_collect (regcache, regno, &val);
|
||||||
|
@ -455,7 +450,7 @@ static void
|
||||||
i386_linux_fetch_inferior_registers (struct target_ops *ops,
|
i386_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
|
|
||||||
/* Use the old method of peeking around in `struct user' if the
|
/* Use the old method of peeking around in `struct user' if the
|
||||||
GETREGS request isn't available. */
|
GETREGS request isn't available. */
|
||||||
|
@ -470,10 +465,7 @@ i386_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
|
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
|
||||||
transfers more registers in one system call, and we'll cache the
|
transfers more registers in one system call, and we'll cache the
|
||||||
|
@ -536,7 +528,7 @@ static void
|
||||||
i386_linux_store_inferior_registers (struct target_ops *ops,
|
i386_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
|
|
||||||
/* Use the old method of poking around in `struct user' if the
|
/* Use the old method of poking around in `struct user' if the
|
||||||
SETREGS request isn't available. */
|
SETREGS request isn't available. */
|
||||||
|
@ -551,10 +543,7 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_SETFPXREGS requests whenever possible, since it
|
/* Use the PTRACE_SETFPXREGS requests whenever possible, since it
|
||||||
transfers more registers in one system call. But remember that
|
transfers more registers in one system call. But remember that
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
/* Prototypes for supply_gregset etc. */
|
/* Prototypes for supply_gregset etc. */
|
||||||
#include "gregset.h"
|
#include "gregset.h"
|
||||||
|
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
/* These must match the order of the register names.
|
/* These must match the order of the register names.
|
||||||
|
|
||||||
Some sort of lookup table is needed because the offsets associated
|
Some sort of lookup table is needed because the offsets associated
|
||||||
|
@ -696,7 +698,8 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
PTRACE_TYPE_RET *buf;
|
PTRACE_TYPE_RET *buf;
|
||||||
int pid, i;
|
pid_t pid;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* r0 cannot be fetched but is always zero. */
|
/* r0 cannot be fetched but is always zero. */
|
||||||
if (regnum == IA64_GR0_REGNUM)
|
if (regnum == IA64_GR0_REGNUM)
|
||||||
|
@ -735,11 +738,7 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cater for systems like GNU/Linux, that implement threads as
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
separate processes. */
|
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
/* This isn't really an address, but ptrace thinks of it as one. */
|
/* This isn't really an address, but ptrace thinks of it as one. */
|
||||||
addr = ia64_register_addr (gdbarch, regnum);
|
addr = ia64_register_addr (gdbarch, regnum);
|
||||||
|
@ -788,16 +787,13 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
PTRACE_TYPE_RET *buf;
|
PTRACE_TYPE_RET *buf;
|
||||||
int pid, i;
|
pid_t pid;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (ia64_cannot_store_register (gdbarch, regnum))
|
if (ia64_cannot_store_register (gdbarch, regnum))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Cater for systems like GNU/Linux, that implement threads as
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
separate processes. */
|
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
/* This isn't really an address, but ptrace thinks of it as one. */
|
/* This isn't really an address, but ptrace thinks of it as one. */
|
||||||
addr = ia64_register_addr (gdbarch, regnum);
|
addr = ia64_register_addr (gdbarch, regnum);
|
||||||
|
|
|
@ -708,7 +708,8 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
PTRACE_TYPE_RET *buf;
|
PTRACE_TYPE_RET *buf;
|
||||||
int pid, i;
|
pid_t pid;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* This isn't really an address, but ptrace thinks of it as one. */
|
/* This isn't really an address, but ptrace thinks of it as one. */
|
||||||
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
|
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
|
||||||
|
@ -719,11 +720,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cater for systems like GNU/Linux, that implement threads as
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
separate processes. */
|
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
size = register_size (gdbarch, regnum);
|
size = register_size (gdbarch, regnum);
|
||||||
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
|
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
|
||||||
|
@ -769,7 +766,8 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
size_t size;
|
size_t size;
|
||||||
PTRACE_TYPE_RET *buf;
|
PTRACE_TYPE_RET *buf;
|
||||||
int pid, i;
|
pid_t pid;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* This isn't really an address, but ptrace thinks of it as one. */
|
/* This isn't really an address, but ptrace thinks of it as one. */
|
||||||
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 1);
|
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 1);
|
||||||
|
@ -777,11 +775,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
|
||||||
|| gdbarch_cannot_store_register (gdbarch, regnum))
|
|| gdbarch_cannot_store_register (gdbarch, regnum))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Cater for systems like GNU/Linux, that implement threads as
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
separate processes. */
|
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
size = register_size (gdbarch, regnum);
|
size = register_size (gdbarch, regnum);
|
||||||
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
|
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "nat/gdb_ptrace.h"
|
#include "nat/gdb_ptrace.h"
|
||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
#include <sys/procfs.h>
|
#include <sys/procfs.h>
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
/* Prototypes for supply_gregset etc. */
|
/* Prototypes for supply_gregset etc. */
|
||||||
#include "gregset.h"
|
#include "gregset.h"
|
||||||
|
@ -194,12 +195,7 @@ static void
|
||||||
m32r_linux_fetch_inferior_registers (struct target_ops *ops,
|
m32r_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_GETREGS request whenever possible, since it
|
/* Use the PTRACE_GETREGS request whenever possible, since it
|
||||||
transfers more registers in one system call, and we'll cache the
|
transfers more registers in one system call, and we'll cache the
|
||||||
|
@ -221,11 +217,7 @@ static void
|
||||||
m32r_linux_store_inferior_registers (struct target_ops *ops,
|
m32r_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_SETREGS request whenever possible, since it
|
/* Use the PTRACE_SETREGS request whenever possible, since it
|
||||||
transfers more registers in one system call. */
|
transfers more registers in one system call. */
|
||||||
|
|
|
@ -111,12 +111,13 @@ static void
|
||||||
m68kbsd_fetch_inferior_registers (struct target_ops *ops,
|
m68kbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
|
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
m68kbsd_supply_gregset (regcache, ®s);
|
m68kbsd_supply_gregset (regcache, ®s);
|
||||||
|
@ -126,8 +127,7 @@ m68kbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
m68kbsd_supply_fpregset (regcache, &fpregs);
|
m68kbsd_supply_fpregset (regcache, &fpregs);
|
||||||
|
@ -141,18 +141,18 @@ static void
|
||||||
m68kbsd_store_inferior_registers (struct target_ops *ops,
|
m68kbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
|
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
m68kbsd_collect_gregset (regcache, ®s, regnum);
|
m68kbsd_collect_gregset (regcache, ®s, regnum);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,14 +160,12 @@ m68kbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
|
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write floating point status"));
|
perror_with_name (_("Couldn't write floating point status"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
/* Defines ps_err_e, struct ps_prochandle. */
|
/* Defines ps_err_e, struct ps_prochandle. */
|
||||||
#include "gdb_proc_service.h"
|
#include "gdb_proc_service.h"
|
||||||
|
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
#ifndef PTRACE_GET_THREAD_AREA
|
#ifndef PTRACE_GET_THREAD_AREA
|
||||||
#define PTRACE_GET_THREAD_AREA 25
|
#define PTRACE_GET_THREAD_AREA 25
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,13 +108,7 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
long regaddr, val;
|
long regaddr, val;
|
||||||
int i;
|
int i;
|
||||||
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
|
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
|
||||||
int tid;
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
/* Overload thread id onto process id. */
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* no thread id, just use
|
|
||||||
process id. */
|
|
||||||
|
|
||||||
regaddr = 4 * regmap[regno];
|
regaddr = 4 * regmap[regno];
|
||||||
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
|
for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
|
||||||
|
@ -159,14 +155,8 @@ store_register (const struct regcache *regcache, int regno)
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
long regaddr, val;
|
long regaddr, val;
|
||||||
int i;
|
int i;
|
||||||
int tid;
|
|
||||||
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
|
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
|
||||||
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
/* Overload thread id onto process id. */
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* no thread id, just use
|
|
||||||
process id. */
|
|
||||||
|
|
||||||
regaddr = 4 * regmap[regno];
|
regaddr = 4 * regmap[regno];
|
||||||
|
|
||||||
|
@ -406,7 +396,7 @@ static void
|
||||||
m68k_linux_fetch_inferior_registers (struct target_ops *ops,
|
m68k_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
|
|
||||||
/* Use the old method of peeking around in `struct user' if the
|
/* Use the old method of peeking around in `struct user' if the
|
||||||
GETREGS request isn't available. */
|
GETREGS request isn't available. */
|
||||||
|
@ -416,10 +406,7 @@ m68k_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
|
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
|
||||||
transfers more registers in one system call, and we'll cache the
|
transfers more registers in one system call, and we'll cache the
|
||||||
|
@ -463,7 +450,7 @@ static void
|
||||||
m68k_linux_store_inferior_registers (struct target_ops *ops,
|
m68k_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int tid;
|
pid_t tid;
|
||||||
|
|
||||||
/* Use the old method of poking around in `struct user' if the
|
/* Use the old method of poking around in `struct user' if the
|
||||||
SETREGS request isn't available. */
|
SETREGS request isn't available. */
|
||||||
|
@ -473,10 +460,7 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GNU/Linux LWP ID's are process ID's. */
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
|
|
||||||
|
|
||||||
/* Use the PTRACE_SETFPREGS requests whenever possible, since it
|
/* Use the PTRACE_SETFPREGS requests whenever possible, since it
|
||||||
transfers more registers in one system call. But remember that
|
transfers more registers in one system call. But remember that
|
||||||
|
|
|
@ -68,7 +68,7 @@ m88kbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ m88kbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
m88kbsd_collect_gregset (regcache, ®s, regnum);
|
m88kbsd_collect_gregset (regcache, ®s, regnum);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,14 @@ static void
|
||||||
mips_fbsd_fetch_inferior_registers (struct target_ops *ops,
|
mips_fbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
|
pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mips_fbsd_supply_gregs (regcache, regnum, ®s, sizeof (register_t));
|
mips_fbsd_supply_gregs (regcache, regnum, ®s, sizeof (register_t));
|
||||||
|
@ -66,8 +67,7 @@ mips_fbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
mips_fbsd_supply_fpregs (regcache, regnum, &fpregs,
|
mips_fbsd_supply_fpregs (regcache, regnum, &fpregs,
|
||||||
|
@ -82,20 +82,20 @@ static void
|
||||||
mips_fbsd_store_inferior_registers (struct target_ops *ops,
|
mips_fbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
|
pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mips_fbsd_collect_gregs (regcache, regnum, (char *) ®s,
|
mips_fbsd_collect_gregs (regcache, regnum, (char *) ®s,
|
||||||
sizeof (register_t));
|
sizeof (register_t));
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
|
|
||||||
if (regnum != -1)
|
if (regnum != -1)
|
||||||
|
@ -107,15 +107,13 @@ mips_fbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs,
|
mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs,
|
||||||
sizeof (f_register_t));
|
sizeof (f_register_t));
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write floating point status"));
|
perror_with_name (_("Couldn't write floating point status"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <sgidefs.h>
|
#include <sgidefs.h>
|
||||||
#include "nat/gdb_ptrace.h"
|
#include "nat/gdb_ptrace.h"
|
||||||
#include <asm/ptrace.h>
|
#include <asm/ptrace.h>
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
#include "nat/mips-linux-watch.h"
|
#include "nat/mips-linux-watch.h"
|
||||||
|
|
||||||
|
@ -244,9 +245,7 @@ mips64_linux_regsets_fetch_registers (struct target_ops *ops,
|
||||||
else
|
else
|
||||||
is_dsp = 0;
|
is_dsp = 0;
|
||||||
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regno == -1 || (!is_fp && !is_dsp))
|
if (regno == -1 || (!is_fp && !is_dsp))
|
||||||
{
|
{
|
||||||
|
@ -332,9 +331,7 @@ mips64_linux_regsets_store_registers (struct target_ops *ops,
|
||||||
else
|
else
|
||||||
is_dsp = 0;
|
is_dsp = 0;
|
||||||
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regno == -1 || (!is_fp && !is_dsp))
|
if (regno == -1 || (!is_fp && !is_dsp))
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,13 +42,14 @@ static void
|
||||||
mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
|
mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
if (regno == -1 || getregs_supplies (gdbarch, regno))
|
if (regno == -1 || getregs_supplies (gdbarch, regno))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mipsnbsd_supply_reg (regcache, (char *) ®s, regno);
|
mipsnbsd_supply_reg (regcache, (char *) ®s, regno);
|
||||||
|
@ -61,8 +62,7 @@ mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
|
mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
|
||||||
|
@ -73,19 +73,19 @@ static void
|
||||||
mipsnbsd_store_inferior_registers (struct target_ops *ops,
|
mipsnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
if (regno == -1 || getregs_supplies (gdbarch, regno))
|
if (regno == -1 || getregs_supplies (gdbarch, regno))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mipsnbsd_fill_reg (regcache, (char *) ®s, regno);
|
mipsnbsd_fill_reg (regcache, (char *) ®s, regno);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
|
|
||||||
if (regno != -1)
|
if (regno != -1)
|
||||||
|
@ -97,14 +97,12 @@ mipsnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
|
mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write floating point status"));
|
perror_with_name (_("Couldn't write floating point status"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,9 @@ mips64obsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mips64obsd_supply_gregset (regcache, ®s);
|
mips64obsd_supply_gregset (regcache, ®s);
|
||||||
|
@ -98,15 +98,14 @@ mips64obsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
mips64obsd_collect_gregset (regcache, ®s, regnum);
|
mips64obsd_collect_gregset (regcache, ®s, regnum);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -868,7 +868,7 @@ procfs_fetch_registers (struct target_ops *ops,
|
||||||
reg;
|
reg;
|
||||||
int regsize;
|
int regsize;
|
||||||
|
|
||||||
procfs_set_thread (inferior_ptid);
|
procfs_set_thread (regcache_get_ptid (regcache));
|
||||||
if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK)
|
if (devctl (ctl_fd, DCMD_PROC_GETGREG, ®, sizeof (reg), ®size) == EOK)
|
||||||
nto_supply_gregset (regcache, (char *) ®.greg);
|
nto_supply_gregset (regcache, (char *) ®.greg);
|
||||||
if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size)
|
if (devctl (ctl_fd, DCMD_PROC_GETFPREG, ®, sizeof (reg), ®size)
|
||||||
|
@ -1350,10 +1350,11 @@ procfs_store_registers (struct target_ops *ops,
|
||||||
unsigned off;
|
unsigned off;
|
||||||
int len, regset, regsize, dev_set, err;
|
int len, regset, regsize, dev_set, err;
|
||||||
char *data;
|
char *data;
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (ptid_equal (inferior_ptid, null_ptid))
|
if (ptid_equal (ptid, null_ptid))
|
||||||
return;
|
return;
|
||||||
procfs_set_thread (inferior_ptid);
|
procfs_set_thread (ptid);
|
||||||
|
|
||||||
if (regno == -1)
|
if (regno == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,9 +120,9 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
gdb_gregset_t regs;
|
gdb_gregset_t regs;
|
||||||
|
pid_t pid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
supply_gregset (regcache, ®s);
|
supply_gregset (regcache, ®s);
|
||||||
|
@ -132,8 +132,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
const struct regset *fpregset = ppc_fbsd_fpregset ();
|
const struct regset *fpregset = ppc_fbsd_fpregset ();
|
||||||
gdb_fpregset_t fpregs;
|
gdb_fpregset_t fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get FP registers"));
|
perror_with_name (_("Couldn't get FP registers"));
|
||||||
|
|
||||||
ppc_supply_fpregset (fpregset, regcache, regno, &fpregs, sizeof fpregs);
|
ppc_supply_fpregset (fpregset, regcache, regno, &fpregs, sizeof fpregs);
|
||||||
|
@ -148,29 +147,26 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
gdb_gregset_t regs;
|
gdb_gregset_t regs;
|
||||||
|
pid_t pid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
fill_gregset (regcache, ®s, regno);
|
fill_gregset (regcache, ®s, regno);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
|
|
||||||
if (regno == -1 || getfpregs_supplies (get_regcache_arch (regcache), regno))
|
if (regno == -1 || getfpregs_supplies (get_regcache_arch (regcache), regno))
|
||||||
{
|
{
|
||||||
gdb_fpregset_t fpregs;
|
gdb_fpregset_t fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get FP registers"));
|
perror_with_name (_("Couldn't get FP registers"));
|
||||||
|
|
||||||
fill_fpregset (regcache, &fpregs, regno);
|
fill_fpregset (regcache, &fpregs, regno);
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, ptid_get_lwp (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't set FP registers"));
|
perror_with_name (_("Couldn't set FP registers"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/procfs.h>
|
#include <sys/procfs.h>
|
||||||
#include "nat/gdb_ptrace.h"
|
#include "nat/gdb_ptrace.h"
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
/* Prototypes for supply_gregset etc. */
|
/* Prototypes for supply_gregset etc. */
|
||||||
#include "gregset.h"
|
#include "gregset.h"
|
||||||
|
@ -809,12 +810,7 @@ static void
|
||||||
ppc_linux_fetch_inferior_registers (struct target_ops *ops,
|
ppc_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
/* Overload thread id onto process id. */
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
|
|
||||||
/* No thread id, just use process id. */
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regno == -1)
|
if (regno == -1)
|
||||||
fetch_ppc_registers (regcache, tid);
|
fetch_ppc_registers (regcache, tid);
|
||||||
|
@ -2291,12 +2287,7 @@ static void
|
||||||
ppc_linux_store_inferior_registers (struct target_ops *ops,
|
ppc_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
/* Overload thread id onto process id. */
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
|
|
||||||
/* No thread id, just use process id. */
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regno >= 0)
|
if (regno >= 0)
|
||||||
store_register (regcache, tid, regno);
|
store_register (regcache, tid, regno);
|
||||||
|
|
|
@ -81,13 +81,13 @@ ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
ppc_supply_gregset (&ppcnbsd_gregset, regcache,
|
ppc_supply_gregset (&ppcnbsd_gregset, regcache,
|
||||||
|
@ -98,8 +98,7 @@ ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get FP registers"));
|
perror_with_name (_("Couldn't get FP registers"));
|
||||||
|
|
||||||
ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
|
ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
|
||||||
|
@ -112,20 +111,19 @@ ppcnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
ppc_collect_gregset (&ppcnbsd_gregset, regcache,
|
ppc_collect_gregset (&ppcnbsd_gregset, regcache,
|
||||||
regnum, ®s, sizeof regs);
|
regnum, ®s, sizeof regs);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,15 +131,13 @@ ppcnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get FP registers"));
|
perror_with_name (_("Couldn't get FP registers"));
|
||||||
|
|
||||||
ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
|
ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
|
||||||
regnum, &fpregs, sizeof fpregs);
|
regnum, &fpregs, sizeof fpregs);
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't set FP registers"));
|
perror_with_name (_("Couldn't set FP registers"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,9 @@ ppcobsd_fetch_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
ppc_supply_gregset (&ppcobsd_gregset, regcache, -1,
|
ppc_supply_gregset (&ppcobsd_gregset, regcache, -1,
|
||||||
|
@ -93,8 +93,7 @@ ppcobsd_fetch_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1,
|
ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1,
|
||||||
|
@ -111,9 +110,9 @@ ppcobsd_store_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
ppc_collect_gregset (&ppcobsd_gregset, regcache,
|
ppc_collect_gregset (&ppcobsd_gregset, regcache,
|
||||||
|
@ -123,8 +122,7 @@ ppcobsd_store_registers (struct target_ops *ops,
|
||||||
regnum, ®s, sizeof regs);
|
regnum, ®s, sizeof regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
|
|
||||||
#ifdef PT_GETFPREGS
|
#ifdef PT_GETFPREGS
|
||||||
|
@ -133,15 +131,13 @@ ppcobsd_store_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
struct fpreg fpregs;
|
struct fpreg fpregs;
|
||||||
|
|
||||||
if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get floating point status"));
|
perror_with_name (_("Couldn't get floating point status"));
|
||||||
|
|
||||||
ppc_collect_fpregset (&ppcobsd_fpregset, regcache,
|
ppc_collect_fpregset (&ppcobsd_fpregset, regcache,
|
||||||
regnum, &fpregs, sizeof fpregs);
|
regnum, &fpregs, sizeof fpregs);
|
||||||
|
|
||||||
if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write floating point status"));
|
perror_with_name (_("Couldn't write floating point status"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
14
gdb/procfs.c
14
gdb/procfs.c
|
@ -3219,15 +3219,16 @@ procfs_fetch_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
gdb_gregset_t *gregs;
|
gdb_gregset_t *gregs;
|
||||||
procinfo *pi;
|
procinfo *pi;
|
||||||
int pid = ptid_get_pid (inferior_ptid);
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
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);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
|
||||||
pi = find_procinfo_or_die (pid, tid);
|
pi = find_procinfo_or_die (pid, tid);
|
||||||
|
|
||||||
if (pi == NULL)
|
if (pi == NULL)
|
||||||
error (_("procfs: fetch_registers failed to find procinfo for %s"),
|
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);
|
gregs = proc_get_gregs (pi);
|
||||||
if (gregs == NULL)
|
if (gregs == NULL)
|
||||||
|
@ -3268,15 +3269,16 @@ procfs_store_registers (struct target_ops *ops,
|
||||||
{
|
{
|
||||||
gdb_gregset_t *gregs;
|
gdb_gregset_t *gregs;
|
||||||
procinfo *pi;
|
procinfo *pi;
|
||||||
int pid = ptid_get_pid (inferior_ptid);
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
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);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
|
||||||
pi = find_procinfo_or_die (pid, tid);
|
pi = find_procinfo_or_die (pid, tid);
|
||||||
|
|
||||||
if (pi == NULL)
|
if (pi == NULL)
|
||||||
error (_("procfs: store_registers: failed to find procinfo for %s"),
|
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);
|
gregs = proc_get_gregs (pi);
|
||||||
if (gregs == NULL)
|
if (gregs == NULL)
|
||||||
|
|
|
@ -268,10 +268,11 @@ ravenscar_fetch_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct target_ops *beneath = find_target_beneath (ops);
|
struct target_ops *beneath = find_target_beneath (ops);
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (!ravenscar_runtime_initialized ()
|
if (!ravenscar_runtime_initialized ()
|
||||||
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|
|| ptid_equal (ptid, base_magic_null_ptid)
|
||||||
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
|
|| ptid_equal (ptid, ravenscar_running_thread ()))
|
||||||
beneath->to_fetch_registers (beneath, regcache, regnum);
|
beneath->to_fetch_registers (beneath, regcache, regnum);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -288,10 +289,11 @@ ravenscar_store_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct target_ops *beneath = find_target_beneath (ops);
|
struct target_ops *beneath = find_target_beneath (ops);
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (!ravenscar_runtime_initialized ()
|
if (!ravenscar_runtime_initialized ()
|
||||||
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|
|| ptid_equal (ptid, base_magic_null_ptid)
|
||||||
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
|
|| ptid_equal (ptid, ravenscar_running_thread ()))
|
||||||
beneath->to_store_registers (beneath, regcache, regnum);
|
beneath->to_store_registers (beneath, regcache, regnum);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -308,10 +310,11 @@ ravenscar_prepare_to_store (struct target_ops *self,
|
||||||
struct regcache *regcache)
|
struct regcache *regcache)
|
||||||
{
|
{
|
||||||
struct target_ops *beneath = find_target_beneath (self);
|
struct target_ops *beneath = find_target_beneath (self);
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (!ravenscar_runtime_initialized ()
|
if (!ravenscar_runtime_initialized ()
|
||||||
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|
|| ptid_equal (ptid, base_magic_null_ptid)
|
||||||
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
|
|| ptid_equal (ptid, ravenscar_running_thread ()))
|
||||||
beneath->to_prepare_to_store (beneath, regcache);
|
beneath->to_prepare_to_store (beneath, regcache);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1425,7 +1425,7 @@ record_btrace_fetch_registers (struct target_ops *ops,
|
||||||
struct btrace_insn_iterator *replay;
|
struct btrace_insn_iterator *replay;
|
||||||
struct thread_info *tp;
|
struct thread_info *tp;
|
||||||
|
|
||||||
tp = find_thread_ptid (inferior_ptid);
|
tp = find_thread_ptid (regcache_get_ptid (regcache));
|
||||||
gdb_assert (tp != NULL);
|
gdb_assert (tp != NULL);
|
||||||
|
|
||||||
replay = tp->btrace.replay;
|
replay = tp->btrace.replay;
|
||||||
|
@ -1466,7 +1466,7 @@ record_btrace_store_registers (struct target_ops *ops,
|
||||||
struct target_ops *t;
|
struct target_ops *t;
|
||||||
|
|
||||||
if (!record_btrace_generating_corefile
|
if (!record_btrace_generating_corefile
|
||||||
&& record_btrace_is_replaying (ops, inferior_ptid))
|
&& record_btrace_is_replaying (ops, regcache_get_ptid (regcache)))
|
||||||
error (_("Cannot write registers while replaying."));
|
error (_("Cannot write registers while replaying."));
|
||||||
|
|
||||||
gdb_assert (may_write_registers != 0);
|
gdb_assert (may_write_registers != 0);
|
||||||
|
@ -1484,7 +1484,7 @@ record_btrace_prepare_to_store (struct target_ops *ops,
|
||||||
struct target_ops *t;
|
struct target_ops *t;
|
||||||
|
|
||||||
if (!record_btrace_generating_corefile
|
if (!record_btrace_generating_corefile
|
||||||
&& record_btrace_is_replaying (ops, inferior_ptid))
|
&& record_btrace_is_replaying (ops, regcache_get_ptid (regcache)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t = ops->beneath;
|
t = ops->beneath;
|
||||||
|
|
|
@ -429,8 +429,9 @@ gdbsim_fetch_register (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache));
|
||||||
struct sim_inferior_data *sim_data
|
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)
|
if (regno == -1)
|
||||||
{
|
{
|
||||||
|
@ -505,8 +506,9 @@ gdbsim_store_register (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct inferior *inf = find_inferior_ptid (regcache_get_ptid (regcache));
|
||||||
struct sim_inferior_data *sim_data
|
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)
|
if (regno == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7711,7 +7711,7 @@ remote_fetch_registers (struct target_ops *ops,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
set_remote_traceframe ();
|
set_remote_traceframe ();
|
||||||
set_general_thread (inferior_ptid);
|
set_general_thread (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum >= 0)
|
if (regnum >= 0)
|
||||||
{
|
{
|
||||||
|
@ -7868,7 +7868,7 @@ remote_store_registers (struct target_ops *ops,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
set_remote_traceframe ();
|
set_remote_traceframe ();
|
||||||
set_general_thread (inferior_ptid);
|
set_general_thread (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum >= 0)
|
if (regnum >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,6 +164,7 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
int addr[MAX_REGISTER_SIZE];
|
int addr[MAX_REGISTER_SIZE];
|
||||||
int nr, isfloat;
|
int nr, isfloat;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
/* Retrieved values may be -1, so infer errors from errno. */
|
/* Retrieved values may be -1, so infer errors from errno. */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -172,7 +173,7 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
|
|
||||||
/* Floating-point registers. */
|
/* Floating-point registers. */
|
||||||
if (isfloat)
|
if (isfloat)
|
||||||
rs6000_ptrace32 (PT_READ_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
|
rs6000_ptrace32 (PT_READ_FPR, pid, addr, nr, 0);
|
||||||
|
|
||||||
/* Bogus register number. */
|
/* Bogus register number. */
|
||||||
else if (nr < 0)
|
else if (nr < 0)
|
||||||
|
@ -188,15 +189,13 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ARCH64 ())
|
if (!ARCH64 ())
|
||||||
*addr = rs6000_ptrace32 (PT_READ_GPR, ptid_get_pid (inferior_ptid),
|
*addr = rs6000_ptrace32 (PT_READ_GPR, pid, (int *) nr, 0, 0);
|
||||||
(int *) nr, 0, 0);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* PT_READ_GPR requires the buffer parameter to point to long long,
|
/* PT_READ_GPR requires the buffer parameter to point to long long,
|
||||||
even if the register is really only 32 bits. */
|
even if the register is really only 32 bits. */
|
||||||
long long buf;
|
long long buf;
|
||||||
rs6000_ptrace64 (PT_READ_GPR, ptid_get_pid (inferior_ptid),
|
rs6000_ptrace64 (PT_READ_GPR, pid, nr, 0, &buf);
|
||||||
nr, 0, &buf);
|
|
||||||
if (register_size (gdbarch, regno) == 8)
|
if (register_size (gdbarch, regno) == 8)
|
||||||
memcpy (addr, &buf, 8);
|
memcpy (addr, &buf, 8);
|
||||||
else
|
else
|
||||||
|
@ -224,6 +223,7 @@ store_register (struct regcache *regcache, int regno)
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
int addr[MAX_REGISTER_SIZE];
|
int addr[MAX_REGISTER_SIZE];
|
||||||
int nr, isfloat;
|
int nr, isfloat;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
/* Fetch the register's value from the register cache. */
|
/* Fetch the register's value from the register cache. */
|
||||||
regcache_raw_collect (regcache, regno, addr);
|
regcache_raw_collect (regcache, regno, addr);
|
||||||
|
@ -235,7 +235,7 @@ store_register (struct regcache *regcache, int regno)
|
||||||
|
|
||||||
/* Floating-point registers. */
|
/* Floating-point registers. */
|
||||||
if (isfloat)
|
if (isfloat)
|
||||||
rs6000_ptrace32 (PT_WRITE_FPR, ptid_get_pid (inferior_ptid), addr, nr, 0);
|
rs6000_ptrace32 (PT_WRITE_FPR, pid, addr, nr, 0);
|
||||||
|
|
||||||
/* Bogus register number. */
|
/* Bogus register number. */
|
||||||
else if (nr < 0)
|
else if (nr < 0)
|
||||||
|
@ -253,8 +253,7 @@ store_register (struct regcache *regcache, int regno)
|
||||||
the register's value is passed by value, but for 64-bit inferiors,
|
the register's value is passed by value, but for 64-bit inferiors,
|
||||||
the address of a buffer containing the value is passed. */
|
the address of a buffer containing the value is passed. */
|
||||||
if (!ARCH64 ())
|
if (!ARCH64 ())
|
||||||
rs6000_ptrace32 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
|
rs6000_ptrace32 (PT_WRITE_GPR, pid, (int *) nr, *addr, 0);
|
||||||
(int *) nr, *addr, 0);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
|
/* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
|
||||||
|
@ -264,8 +263,7 @@ store_register (struct regcache *regcache, int regno)
|
||||||
memcpy (&buf, addr, 8);
|
memcpy (&buf, addr, 8);
|
||||||
else
|
else
|
||||||
buf = *addr;
|
buf = *addr;
|
||||||
rs6000_ptrace64 (PT_WRITE_GPR, ptid_get_pid (inferior_ptid),
|
rs6000_ptrace64 (PT_WRITE_GPR, pid, nr, 0, &buf);
|
||||||
nr, 0, &buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <sys/ucontext.h>
|
#include <sys/ucontext.h>
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
/* Per-thread arch-specific data. */
|
/* Per-thread arch-specific data. */
|
||||||
|
|
||||||
|
@ -370,7 +371,7 @@ static void
|
||||||
s390_linux_fetch_inferior_registers (struct target_ops *ops,
|
s390_linux_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = s390_inferior_tid ();
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
|
if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
|
||||||
fetch_regs (regcache, tid);
|
fetch_regs (regcache, tid);
|
||||||
|
@ -413,7 +414,7 @@ static void
|
||||||
s390_linux_store_inferior_registers (struct target_ops *ops,
|
s390_linux_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = s390_inferior_tid ();
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
|
if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
|
||||||
store_regs (regcache, tid, regnum);
|
store_regs (regcache, tid, regnum);
|
||||||
|
|
|
@ -45,11 +45,13 @@ static void
|
||||||
shnbsd_fetch_inferior_registers (struct target_ops *ops,
|
shnbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
|
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
|
||||||
{
|
{
|
||||||
struct reg inferior_registers;
|
struct reg inferior_registers;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid,
|
||||||
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
|
@ -66,11 +68,13 @@ static void
|
||||||
shnbsd_store_inferior_registers (struct target_ops *ops,
|
shnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regno)
|
struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
|
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
|
||||||
{
|
{
|
||||||
struct reg inferior_registers;
|
struct reg inferior_registers;
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid,
|
||||||
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ shnbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
(char *) &inferior_registers,
|
(char *) &inferior_registers,
|
||||||
SHNBSD_SIZEOF_GREGS);
|
SHNBSD_SIZEOF_GREGS);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid,
|
||||||
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
|
||||||
perror_with_name (_("Couldn't set registers"));
|
perror_with_name (_("Couldn't set registers"));
|
||||||
|
|
||||||
|
|
|
@ -462,16 +462,17 @@ sol_thread_fetch_registers (struct target_ops *ops,
|
||||||
gdb_gregset_t *gregset_p = &gregset;
|
gdb_gregset_t *gregset_p = &gregset;
|
||||||
gdb_fpregset_t *fpregset_p = &fpregset;
|
gdb_fpregset_t *fpregset_p = &fpregset;
|
||||||
struct target_ops *beneath = find_target_beneath (ops);
|
struct target_ops *beneath = find_target_beneath (ops);
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (!ptid_tid_p (inferior_ptid))
|
if (!ptid_tid_p (ptid))
|
||||||
{
|
{
|
||||||
/* It's an LWP; pass the request on to the layer beneath. */
|
/* 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, regnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Solaris thread: convert INFERIOR_PTID into a td_thrhandle_t. */
|
/* Solaris thread: convert PTID into a td_thrhandle_t. */
|
||||||
thread = ptid_get_tid (inferior_ptid);
|
thread = ptid_get_tid (ptid);
|
||||||
if (thread == 0)
|
if (thread == 0)
|
||||||
error (_("sol_thread_fetch_registers: thread == 0"));
|
error (_("sol_thread_fetch_registers: thread == 0"));
|
||||||
|
|
||||||
|
@ -514,8 +515,9 @@ sol_thread_store_registers (struct target_ops *ops,
|
||||||
td_err_e val;
|
td_err_e val;
|
||||||
prgregset_t gregset;
|
prgregset_t gregset;
|
||||||
prfpregset_t fpregset;
|
prfpregset_t fpregset;
|
||||||
|
ptid_t ptid = regcache_get_ptid (regcache);
|
||||||
|
|
||||||
if (!ptid_tid_p (inferior_ptid))
|
if (!ptid_tid_p (ptid))
|
||||||
{
|
{
|
||||||
struct target_ops *beneath = find_target_beneath (ops);
|
struct target_ops *beneath = find_target_beneath (ops);
|
||||||
|
|
||||||
|
@ -524,8 +526,8 @@ sol_thread_store_registers (struct target_ops *ops,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Solaris thread: convert INFERIOR_PTID into a td_thrhandle_t. */
|
/* Solaris thread: convert PTID into a td_thrhandle_t. */
|
||||||
thread = ptid_get_tid (inferior_ptid);
|
thread = ptid_get_tid (ptid);
|
||||||
|
|
||||||
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
|
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
|
||||||
if (val != TD_OK)
|
if (val != TD_OK)
|
||||||
|
|
|
@ -138,7 +138,7 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
int pid;
|
pid_t pid;
|
||||||
|
|
||||||
/* NOTE: cagney/2002-12-03: This code assumes that the currently
|
/* NOTE: cagney/2002-12-03: This code assumes that the currently
|
||||||
selected light weight processes' registers can be written
|
selected light weight processes' registers can be written
|
||||||
|
@ -153,9 +153,7 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
|
||||||
These functions should instead be paramaterized with an explicit
|
These functions should instead be paramaterized with an explicit
|
||||||
object (struct regcache, struct thread_info?) into which the LWPs
|
object (struct regcache, struct thread_info?) into which the LWPs
|
||||||
registers can be written. */
|
registers can be written. */
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regnum == SPARC_G0_REGNUM)
|
if (regnum == SPARC_G0_REGNUM)
|
||||||
{
|
{
|
||||||
|
@ -193,13 +191,11 @@ sparc_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
int pid;
|
pid_t pid;
|
||||||
|
|
||||||
/* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
|
/* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
|
||||||
about threaded assumptions. */
|
about threaded assumptions. */
|
||||||
pid = ptid_get_lwp (inferior_ptid);
|
pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
if (pid == 0)
|
|
||||||
pid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (regnum == -1 || sparc_gregset_supplies_p (gdbarch, regnum))
|
if (regnum == -1 || sparc_gregset_supplies_p (gdbarch, regnum))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "linux-nat.h"
|
#include "linux-nat.h"
|
||||||
|
#include "inf-ptrace.h"
|
||||||
|
|
||||||
#include "nat/gdb_ptrace.h"
|
#include "nat/gdb_ptrace.h"
|
||||||
|
|
||||||
|
@ -126,11 +127,7 @@ fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
elf_gregset_t regs;
|
elf_gregset_t regs;
|
||||||
int tid;
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
|
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
@ -146,11 +143,7 @@ store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
elf_gregset_t regs;
|
elf_gregset_t regs;
|
||||||
int tid;
|
pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
tid = ptid_get_lwp (inferior_ptid);
|
|
||||||
if (tid == 0)
|
|
||||||
tid = ptid_get_pid (inferior_ptid);
|
|
||||||
|
|
||||||
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
|
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
|
@ -67,9 +67,9 @@ vaxbsd_fetch_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
vaxbsd_supply_gregset (regcache, ®s);
|
vaxbsd_supply_gregset (regcache, ®s);
|
||||||
|
@ -83,15 +83,14 @@ vaxbsd_store_inferior_registers (struct target_ops *ops,
|
||||||
struct regcache *regcache, int regnum)
|
struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
struct reg regs;
|
struct reg regs;
|
||||||
|
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
|
||||||
|
|
||||||
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't get registers"));
|
perror_with_name (_("Couldn't get registers"));
|
||||||
|
|
||||||
vaxbsd_collect_gregset (regcache, ®s, regnum);
|
vaxbsd_collect_gregset (regcache, ®s, regnum);
|
||||||
|
|
||||||
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
|
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
|
||||||
perror_with_name (_("Couldn't write registers"));
|
perror_with_name (_("Couldn't write registers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ supply_fpregset (struct regcache *regcache,
|
||||||
static void
|
static void
|
||||||
fetch_gregs (struct regcache *regcache, int regnum)
|
fetch_gregs (struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
int tid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
gdb_gregset_t regs;
|
gdb_gregset_t regs;
|
||||||
int areg;
|
int areg;
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ fetch_gregs (struct regcache *regcache, int regnum)
|
||||||
static void
|
static void
|
||||||
store_gregs (struct regcache *regcache, int regnum)
|
store_gregs (struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
int tid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
gdb_gregset_t regs;
|
gdb_gregset_t regs;
|
||||||
int areg;
|
int areg;
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ static int xtreg_high;
|
||||||
static void
|
static void
|
||||||
fetch_xtregs (struct regcache *regcache, int regnum)
|
fetch_xtregs (struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
int tid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
const xtensa_regtable_t *ptr;
|
const xtensa_regtable_t *ptr;
|
||||||
char xtregs [XTENSA_ELF_XTREG_SIZE];
|
char xtregs [XTENSA_ELF_XTREG_SIZE];
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ fetch_xtregs (struct regcache *regcache, int regnum)
|
||||||
static void
|
static void
|
||||||
store_xtregs (struct regcache *regcache, int regnum)
|
store_xtregs (struct regcache *regcache, int regnum)
|
||||||
{
|
{
|
||||||
int tid = ptid_get_lwp (inferior_ptid);
|
int tid = ptid_get_lwp (regcache_get_ptid (regcache));
|
||||||
const xtensa_regtable_t *ptr;
|
const xtensa_regtable_t *ptr;
|
||||||
char xtregs [XTENSA_ELF_XTREG_SIZE];
|
char xtregs [XTENSA_ELF_XTREG_SIZE];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue