Use LWP IDs with ptrace register requests on FreeBSD.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 15 Jan 2016 20:21:07 +0000 (12:21 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 19 Jan 2016 16:18:49 +0000 (08:18 -0800)
commit94309df7aa9ab48bec7fb58fdc1deb26e24fc4c1
tree5b43d9a4b9facc4ff224c40cf9a0d8493a8947c7
parent791174281c341539fab650bd934cc0060b7c9720
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.
gdb/ChangeLog
gdb/amd64bsd-nat.c
gdb/i386bsd-nat.c
gdb/inf-ptrace.c
gdb/inf-ptrace.h
gdb/ppcfbsd-nat.c