aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppcfbsd-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-01-15 12:21:07 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2016-01-19 08:18:49 -0800
commit94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1 (patch)
tree5b43d9a4b9facc4ff224c40cf9a0d8493a8947c7 /gdb/ppcfbsd-nat.c
parent791174281c341539fab650bd934cc0060b7c9720 (diff)
downloadgdb-94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1.zip
gdb-94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1.tar.gz
gdb-94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1.tar.bz2
Use LWP IDs with ptrace register requests on FreeBSD.
This allows gdb to fetch per-thread registers for multi-threaded FreeBSD processes. Export get_ptrace_pid() from inf-ptrace.c and use it to determine the PID to pass to ptrace in pan-BSD native targets. NetBSD and OpenBSD also accept LWP IDs for ptrace requests to fetch per-thread state. gdb/ChangeLog: * amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Use get_ptrace_pid. (amd64bsd_store_inferior_registers): Use get_ptrace_pid. (amd64bsd_dr_get): Use get_ptrace_pid. (amd64bsd_dr_set): Use get_ptrace_pid. * i386bsd-nat.c (i386bsd_fetch_inferior_registers): Use get_ptrace_pid. (i386bsd_store_inferior_registers): Use get_ptrace_pid. (i386bsd_dr_get): Use get_ptrace_pid. (i386bsd_dr_set): Use get_ptrace_pid. * inf-ptrace.c (get_ptrace_pid): Export. * inf-ptrace.h (get_ptrace_pid): Declare. * ppcfbsd-nat.c (ppcfbsd_fetch_inferior_registers): Use lwp id. (ppcfbsd_store_inferior_registers): Use lwp id.
Diffstat (limited to 'gdb/ppcfbsd-nat.c')
-rw-r--r--gdb/ppcfbsd-nat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/ppcfbsd-nat.c b/gdb/ppcfbsd-nat.c
index b41ed70..999e383 100644
--- a/gdb/ppcfbsd-nat.c
+++ b/gdb/ppcfbsd-nat.c
@@ -121,7 +121,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
{
gdb_gregset_t regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
@@ -132,7 +132,7 @@ ppcfbsd_fetch_inferior_registers (struct target_ops *ops,
const struct regset *fpregset = ppc_fbsd_fpregset ();
gdb_fpregset_t fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
@@ -149,13 +149,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops,
{
gdb_gregset_t regs;
- if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't get registers"));
fill_gregset (regcache, &regs, regno);
- if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't write registers"));
@@ -163,13 +163,13 @@ ppcfbsd_store_inferior_registers (struct target_ops *ops,
{
gdb_fpregset_t fpregs;
- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_GETFPREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't get FP registers"));
fill_fpregset (regcache, &fpregs, regno);
- if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
+ if (ptrace (PT_SETFPREGS, ptid_get_lwp (inferior_ptid),
(PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
perror_with_name (_("Couldn't set FP registers"));
}