From patchwork Sat Jul 15 17:20:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 21631 Received: (qmail 53422 invoked by alias); 15 Jul 2017 17:30:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 53295 invoked by uid 89); 15 Jul 2017 17:30:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Jul 2017 17:30:22 +0000 Received: from ralph.baldwin.cx.com (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id C1C7E10AF0F; Sat, 15 Jul 2017 13:21:46 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org, coypu@sdf.org Subject: [PATCH 4/4] Define a DBREG_DRX macro on NetBSD. Date: Sat, 15 Jul 2017 10:20:21 -0700 Message-Id: <20170715172021.80516-5-jhb@FreeBSD.org> In-Reply-To: <20170715172021.80516-1-jhb@FreeBSD.org> References: <20170715172021.80516-1-jhb@FreeBSD.org> X-IsSubscribed: yes 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(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b6a1960d43..44129d9e05 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-07-15 John Baldwin + * x86-bsd-nat.c [!DBREG_DRX && __NetBSD__]: Define DBREG_DRX. + +2017-07-15 John Baldwin + * configure.nat: Add "bsd-kvm.o" and "-lkvm" for NetBSD/amd64. 2017-07-15 John Baldwin diff --git a/gdb/x86-bsd-nat.c b/gdb/x86-bsd-nat.c index 2ff661c179..1d37b2f05d 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)