From patchwork Sat Jul 27 01:41:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Callahan X-Patchwork-Id: 33826 Received: (qmail 15115 invoked by alias); 27 Jul 2019 01:41:58 -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 15107 invoked by uid 89); 27 Jul 2019 01:41:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_PBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, SPF_SOFTFAIL, TO_NO_BRKTS_DYNIP, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=1087, HContent-Transfer-Encoding:8bit X-HELO: emma.port.mk Received: from cpe-66-67-60-203.rochester.res.rr.com (HELO emma.port.mk) (66.67.60.203) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 27 Jul 2019 01:41:56 +0000 Received: from brian (uid 1000) (envelope-from bcallah@openbsd.org) id 1f5371 by emma.port.mk (DragonFly Mail Agent v0.11.21); Fri, 26 Jul 2019 21:41:54 -0400 From: Brian Callahan To: gdb-patches@sourceware.org Subject: [PATCH] Remove header tendrils of x86 hardware breakpoints on OpenBSD Date: Fri, 26 Jul 2019 21:41:54 -0400 Message-Id: <20190727014154.39363-1-bcallah@openbsd.org> MIME-Version: 1.0 This patch #ifndef's out the tendrils of x86 hardware breakpoints on OpenBSD. OpenBSD doesn't have support for it and as a result the build breaks during the linking with undefined symbol errors if you keep it in. I first tried to add x86-nat.o and nat/x86-dregs.o to the list of files built. But if you do that then gdb will segfault when you try to run a program inside it. With this approach, building gdb and running programs inside gdb works. I tried to find a more elegant solution than #ifndef __OpenBSD__ but I could not find a suitable macro that means something akin to "we have/don't have x86 hardware breakpoint support." 2019-07-26 Brian Callahan * gdb/x86-nat.h (struct x86_nat_target : public BaseTarget): Guard with #ifndef __OpenBSD__ to allow gdb to build on OpenBSD --- gdb/ChangeLog | 6 ++++++ gdb/x86-nat.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h index baa4218a87..047bd14140 100644 --- a/gdb/x86-nat.h +++ b/gdb/x86-nat.h @@ -72,6 +72,7 @@ struct x86_nat_target : public BaseTarget { /* Hook in the x86 hardware watchpoints/breakpoints support. */ +#ifndef __OpenBSD__ int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override { return x86_can_use_hw_breakpoint (type, cnt, othertype); } @@ -107,6 +108,7 @@ struct x86_nat_target : public BaseTarget callback will be used. */ bool stopped_by_hw_breakpoint () override { return x86_stopped_by_hw_breakpoint (); } +#endif /* !__OpenBSD__ */ }; #endif /* X86_NAT_H */