summaryrefslogtreecommitdiff
path: root/gdb/x86-bsd-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2017-09-04 19:34:48 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2017-09-04 19:34:48 -0700
commita379bfd00effbbb0fb4df02dc686c2c110023cea (patch)
treed952f87cb734f58eca2aa4a937f75879f00fffe3 /gdb/x86-bsd-nat.c
parentf7efc967ba45350b688e0f661a31eecc15d5e052 (diff)
downloadbinutils-gdb-a379bfd00effbbb0fb4df02dc686c2c110023cea.tar.gz
Enable support for x86 debug registers on NetBSD.
NetBSD recently added PT_GETDBREGS and PT_SETDBREGS ptrace operations that match the existing ones supported by x86-bsd-nat.c. NetBSD's headers do not provide the DBREG_DRX helper macro, so define a local version in x86-bsd-nat.c. In addition, add the x86-nat.o and x86-dregs.o object files to the native NetBSD x86 build targets. gdb/ChangeLog: * configure.nat: Add "x86-nat.o x86-dregs.o" for NetBSD/amd64 and NetBSD/i386. * x86-bsd-nat.c [!DBREG_DRX && __NetBSD__]: Define DBREG_DRX.
Diffstat (limited to 'gdb/x86-bsd-nat.c')
-rw-r--r--gdb/x86-bsd-nat.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/x86-bsd-nat.c b/gdb/x86-bsd-nat.c
index 2ff661c1797..1d37b2f05d4 100644
--- a/gdb/x86-bsd-nat.c
+++ b/gdb/x86-bsd-nat.c
@@ -51,11 +51,16 @@ x86bsd_mourn_inferior (struct target_ops *ops)
super_mourn_inferior (ops);
}
-/* Not all versions of FreeBSD/i386 that support the debug registers
- have this macro. */
+/* Helper macro to access debug register X. FreeBSD/amd64 and modern
+ versions of FreeBSD/i386 provide this macro in system headers. Define
+ a local version for systems that do not provide it. */
#ifndef DBREG_DRX
+#ifdef __NetBSD__
+#define DBREG_DRX(d, x) ((d)->dr[x])
+#else
#define DBREG_DRX(d, x) ((&d->dr0)[x])
#endif
+#endif
static unsigned long
x86bsd_dr_get (ptid_t ptid, int regnum)