aboutsummaryrefslogtreecommitdiff
path: root/gdb/m68k-bsd-nat.c
diff options
context:
space:
mode:
authorKamil Rytarowski <n54@gmx.com>2020-03-14 17:13:38 +0100
committerKamil Rytarowski <n54@gmx.com>2020-03-14 17:13:38 +0100
commit154151a6e303fa4b17e3597e3434a1c5999df8e1 (patch)
tree80a46ec032669ecfabe28d84a9fda4cafc44731d /gdb/m68k-bsd-nat.c
parentbc10778499a971ab9ccecb074cc406d49e1ee608 (diff)
downloadgdb-154151a6e303fa4b17e3597e3434a1c5999df8e1.zip
gdb-154151a6e303fa4b17e3597e3434a1c5999df8e1.tar.gz
gdb-154151a6e303fa4b17e3597e3434a1c5999df8e1.tar.bz2
Add support for NetBSD threads in m68k-bsd-nat.c
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads. gdb/ChangeLog: * m68k-bsd-nat.c (fetch_registers): New variable lwp and pass it to the ptrace call. * m68k-bsd-nat.c (store_registers): Likewise.
Diffstat (limited to 'gdb/m68k-bsd-nat.c')
-rw-r--r--gdb/m68k-bsd-nat.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index a3123a7..9c42da5 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -121,12 +121,13 @@ void
m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
pid_t pid = regcache->ptid ().pid ();
+ int lwp = regcache->ptid ().lwp ();
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_supply_gregset (regcache, &regs);
@@ -136,7 +137,7 @@ m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_supply_fpregset (regcache, &fpregs);
@@ -150,17 +151,18 @@ void
m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
pid_t pid = regcache->ptid ().pid ();
+ int lwp = regcache->ptid ().lwp ();
if (regnum == -1 || m68kbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -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, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
}
@@ -168,12 +170,12 @@ m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -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, lwp) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}