Fix 'last argument of ptrace is the thread id' on NetBSD.

This commit is contained in:
christos 2017-11-30 00:13:29 +00:00
parent 07fcd7718e
commit f7d2582dc8
5 changed files with 33 additions and 33 deletions

View File

@ -49,7 +49,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
amd64_supply_native_gregset (regcache, &regs, -1);
@ -66,7 +66,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops,
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid))
== -1)
perror_with_name (_("Couldn't get extended state status"));
@ -75,7 +75,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops,
}
#endif
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
@ -96,12 +96,12 @@ amd64bsd_store_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@ -117,11 +117,11 @@ amd64bsd_store_inferior_registers (struct target_ops *ops,
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid))
== -1)
perror_with_name (_("Couldn't get extended state status"));
amd64_collect_xsave (regcache, regnum, xstateregs, 0);
amd64_collect_xsave (regcache, regnum, xstateregs, ptid_get_lwp (inferior_ptid));
if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,
x86bsd_xsave_len) == -1)
@ -130,12 +130,12 @@ amd64bsd_store_inferior_registers (struct target_ops *ops,
}
#endif
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}

View File

@ -137,7 +137,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_supply_gregset (regcache, &regs);
@ -159,7 +159,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid,
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
(PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get extended state status"));
i387_supply_xsave (regcache, -1, xstateregs);
@ -169,7 +169,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0)
{
have_ptrace_xmmregs = 1;
i387_supply_fxsave (regcache, -1, xmmregs);
@ -178,7 +178,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
{
have_ptrace_xmmregs = 0;
#endif
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
i387_supply_fsave (regcache, -1, &fpregs);
@ -201,12 +201,12 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@ -227,10 +227,10 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid,
(PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
(PTRACE_TYPE_ARG3) xstateregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get extended state status"));
i387_collect_xsave (regcache, -1, xstateregs, 0);
i387_collect_xsave (regcache, -1, xstateregs, ptid_get_lwp (inferior_ptid));
if (ptrace (PT_SETXSTATE, pid,
(PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
@ -241,25 +241,25 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
&& ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0)
{
have_ptrace_xmmregs = 1;
i387_collect_fxsave (regcache, regnum, xmmregs);
if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write XMM registers"));
}
else
{
have_ptrace_xmmregs = 0;
#endif
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
i387_collect_fsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write floating point status"));
#ifdef HAVE_PT_GETXMMREGS
}

View File

@ -117,7 +117,7 @@ m68kbsd_fetch_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_supply_gregset (regcache, &regs);
@ -127,7 +127,7 @@ m68kbsd_fetch_inferior_registers (struct target_ops *ops,
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_supply_fpregset (regcache, &fpregs);
@ -147,12 +147,12 @@ m68kbsd_store_inferior_registers (struct target_ops *ops,
{
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write registers"));
}
@ -160,12 +160,12 @@ m68kbsd_store_inferior_registers (struct target_ops *ops,
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}

View File

@ -69,7 +69,7 @@ m88kbsd_fetch_inferior_registers (struct target_ops *ops,
struct reg regs;
if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
(PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
m88kbsd_supply_gregset (regcache, &regs);
@ -85,13 +85,13 @@ m88kbsd_store_inferior_registers (struct target_ops *ops,
struct reg regs;
if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
(PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
m88kbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
(PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write registers"));
}

View File

@ -72,7 +72,7 @@ vaxbsd_fetch_inferior_registers (struct target_ops *ops,
struct reg regs;
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
vaxbsd_supply_gregset (regcache, &regs);
@ -88,12 +88,12 @@ vaxbsd_store_inferior_registers (struct target_ops *ops,
struct reg regs;
pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
vaxbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't write registers"));
}