public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Kamil Rytarowski <krytarowski@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Add support for NetBSD threads in sh-nbsd-nat.c Date: Tue, 17 Mar 2020 15:35:37 +0000 (GMT) [thread overview] Message-ID: <20200317153537.22C0A385E82C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a225c9a8692814b4a29360479aee217d73e22d50 commit a225c9a8692814b4a29360479aee217d73e22d50 Author: Kamil Rytarowski <n54@gmx.com> Date: Tue Mar 17 16:31:49 2020 +0100 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. Diff: --- gdb/ChangeLog | 6 ++++++ gdb/sh-nbsd-nat.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b0b98399552..e418e43740d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gdb/sh-nbsd-nat.c b/gdb/sh-nbsd-nat.c index 486ef9d18e9..b4f9db691ce 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)
reply other threads:[~2020-03-17 15:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200317153537.22C0A385E82C@sourceware.org \ --to=krytarowski@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).