diff options
author | Kamil Rytarowski <n54@gmx.com> | 2020-03-17 16:31:49 +0100 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2020-03-17 16:34:06 +0100 |
commit | a225c9a8692814b4a29360479aee217d73e22d50 (patch) | |
tree | 4d6a313043c46a23131c6e700c1a5d60b5408cd0 | |
parent | 9809762324491b851332ce600ae9bde8dd34f601 (diff) | |
download | gdb-a225c9a8692814b4a29360479aee217d73e22d50.zip gdb-a225c9a8692814b4a29360479aee217d73e22d50.tar.gz gdb-a225c9a8692814b4a29360479aee217d73e22d50.tar.bz2 |
Add support for NetBSD threads in sh-nbsd-nat.c
NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads.
gdb/ChangeLog:
* sh-nbsd-nat.c (fetch_registers): New variable lwp and pass
it to the ptrace call.
* sh-nbsd-nat.c (store_registers): Likewise.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/sh-nbsd-nat.c | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b0b9839..e418e43 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-03-17 Kamil Rytarowski <n54@gmx.com> + * sh-nbsd-nat.c (fetch_registers): New variable lwp and pass + it to the ptrace call. + * sh-nbsd-nat.c (store_registers): Likewise. + +2020-03-17 Kamil Rytarowski <n54@gmx.com> + * sh-nbsd-nat.c (sh_nbsd_nat_target): Inherit from nbsd_nat_target instead of inf_ptrace_target. * sh-nbsd-nat.c: Include "nbsd-nat.h", as we are now using diff --git a/gdb/sh-nbsd-nat.c b/gdb/sh-nbsd-nat.c index 486ef9d..b4f9db6 100644 --- a/gdb/sh-nbsd-nat.c +++ b/gdb/sh-nbsd-nat.c @@ -53,13 +53,14 @@ void sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) { pid_t pid = regcache->ptid ().pid (); + int lwp = regcache->ptid ().lwp (); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { struct reg inferior_registers; if (ptrace (PT_GETREGS, pid, - (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno, @@ -75,13 +76,14 @@ void sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno) { pid_t pid = regcache->ptid ().pid (); + int lwp = regcache->ptid ().lwp (); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { struct reg inferior_registers; if (ptrace (PT_GETREGS, pid, - (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno, @@ -89,7 +91,7 @@ sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno) SHNBSD_SIZEOF_GREGS); if (ptrace (PT_SETREGS, pid, - (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) + (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1) perror_with_name (_("Couldn't set registers")); if (regno != -1) |