[4/4] Define a DBREG_DRX macro on NetBSD.
Commit Message
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.
gdb/ChangeLog:
* x86-bsd-nat.c [!DBREG_DRX && __NetBSD__]: Define DBREG_DRX.
---
gdb/ChangeLog | 4 ++++
gdb/x86-bsd-nat.c | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
@@ -1,5 +1,9 @@
2017-07-15 John Baldwin <jhb@FreeBSD.org>
+ * x86-bsd-nat.c [!DBREG_DRX && __NetBSD__]: Define DBREG_DRX.
+
+2017-07-15 John Baldwin <jhb@FreeBSD.org>
+
* configure.nat: Add "bsd-kvm.o" and "-lkvm" for NetBSD/amd64.
2017-07-15 John Baldwin <jhb@FreeBSD.org>
@@ -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)