From 154151a6e303fa4b17e3597e3434a1c5999df8e1 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sat, 14 Mar 2020 17:13:38 +0100 Subject: 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. --- gdb/ChangeLog | 6 ++++++ gdb/m68k-bsd-nat.c | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6703f1d..04db5e7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-03-14 Kamil Rytarowski + * m68k-bsd-nat.c (fetch_registers): New variable lwp and pass + it to the ptrace call. + * m68k-bsd-nat.c (store_registers): Likewise. + +2020-03-14 Kamil Rytarowski + * m68k-bsd-nat.c (m68kbsd_supply_gregset): Change type of regs to gdb_byte *. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. 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) ®s, 0) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); m68kbsd_supply_gregset (regcache, ®s); @@ -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) ®s, 0) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); m68kbsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 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")); } } -- cgit v1.1