mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 12:03:41 +08:00
i386-bsd-nat: Use ptid from regcache instead of inferior_ptid
gdb/ChangeLog: * i386-bsd-nat.c (i386bsd_fetch_inferior_registers, i386bsd_store_inferior_registers): Use ptid from regcache.
This commit is contained in:
parent
bbe1eef1e5
commit
aac12e2497
@ -1,3 +1,8 @@
|
||||
2017-03-17 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers,
|
||||
i386bsd_store_inferior_registers): Use ptid from regcache.
|
||||
|
||||
2017-03-17 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* hppa-obsd-nat.c (hppaobsd_fetch_registers,
|
||||
|
@ -131,12 +131,13 @@ static void
|
||||
i386bsd_fetch_inferior_registers (struct target_ops *ops,
|
||||
struct regcache *regcache, int regnum)
|
||||
{
|
||||
pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||
|
||||
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
|
||||
{
|
||||
struct reg regs;
|
||||
|
||||
if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
perror_with_name (_("Couldn't get registers"));
|
||||
|
||||
i386bsd_supply_gregset (regcache, ®s);
|
||||
@ -157,7 +158,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
|
||||
void *xstateregs;
|
||||
|
||||
xstateregs = alloca (x86bsd_xsave_len);
|
||||
if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
|
||||
if (ptrace (PT_GETXSTATE, pid,
|
||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't get extended state status"));
|
||||
|
||||
@ -168,8 +169,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
|
||||
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
if (have_ptrace_xmmregs != 0
|
||||
&& ptrace(PT_GETXMMREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
|
||||
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
|
||||
{
|
||||
have_ptrace_xmmregs = 1;
|
||||
i387_supply_fxsave (regcache, -1, xmmregs);
|
||||
@ -178,8 +178,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
|
||||
{
|
||||
have_ptrace_xmmregs = 0;
|
||||
#endif
|
||||
if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't get floating point status"));
|
||||
|
||||
i387_supply_fsave (regcache, -1, &fpregs);
|
||||
@ -196,18 +195,18 @@ static void
|
||||
i386bsd_store_inferior_registers (struct target_ops *ops,
|
||||
struct regcache *regcache, int regnum)
|
||||
{
|
||||
pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache));
|
||||
|
||||
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
|
||||
{
|
||||
struct reg regs;
|
||||
|
||||
if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
perror_with_name (_("Couldn't get registers"));
|
||||
|
||||
i386bsd_collect_gregset (regcache, ®s, regnum);
|
||||
|
||||
if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
|
||||
perror_with_name (_("Couldn't write registers"));
|
||||
|
||||
if (regnum != -1)
|
||||
@ -227,13 +226,13 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
|
||||
void *xstateregs;
|
||||
|
||||
xstateregs = alloca (x86bsd_xsave_len);
|
||||
if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
|
||||
if (ptrace (PT_GETXSTATE, pid,
|
||||
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't get extended state status"));
|
||||
|
||||
i387_collect_xsave (regcache, -1, xstateregs, 0);
|
||||
|
||||
if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid),
|
||||
if (ptrace (PT_SETXSTATE, pid,
|
||||
(PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
|
||||
perror_with_name (_("Couldn't write extended state status"));
|
||||
return;
|
||||
@ -242,29 +241,25 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
|
||||
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
if (have_ptrace_xmmregs != 0
|
||||
&& ptrace(PT_GETXMMREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
|
||||
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
|
||||
{
|
||||
have_ptrace_xmmregs = 1;
|
||||
|
||||
i387_collect_fxsave (regcache, regnum, xmmregs);
|
||||
|
||||
if (ptrace (PT_SETXMMREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
|
||||
if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't write XMM registers"));
|
||||
}
|
||||
else
|
||||
{
|
||||
have_ptrace_xmmregs = 0;
|
||||
#endif
|
||||
if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't get floating point status"));
|
||||
|
||||
i387_collect_fsave (regcache, regnum, &fpregs);
|
||||
|
||||
if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid),
|
||||
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
|
||||
perror_with_name (_("Couldn't write floating point status"));
|
||||
#ifdef HAVE_PT_GETXMMREGS
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user