This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove header tendrils of x86 hardware breakpoints on OpenBSD

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 */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]