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

Tom Tromey tom@tromey.com
Tue Aug 6 14:19:00 GMT 2019


>>>>> "Brian" == Brian Callahan <bcallah@openbsd.org> writes:

Brian> This patch #ifndef's out the tendrils of x86 hardware breakpoints
Brian> on OpenBSD.  OpenBSD doesn't have support for it and as a result
Brian> the build breaks during the linking with undefined symbol errors
Brian> if you keep it in.

Are the link errors because x86-nat.o isn't in the build?

Brian> I first tried to add x86-nat.o and nat/x86-dregs.o to the list of
Brian> files built. But if you do that then gdb will segfault when you
Brian> try to run a program inside it.

I don't know much about this area, and I don't know anything at all
really about OpenBSD, but I wonder why it is that this fails.

Brian> I tried to find a more elegant solution than #ifndef __OpenBSD__
Brian> but I could not find a suitable macro that means something akin
Brian> to "we have/don't have x86 hardware breakpoint support."

I didn't track down where the appropriate OpenBSD target is defined, but
another approach would be to make a new target subclass that overrides
these methods to work appropriately for that target.

Brian> +#ifndef __OpenBSD__
Brian>    int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
Brian>    { return x86_can_use_hw_breakpoint (type, cnt, othertype); }
 
Brian> @@ -107,6 +108,7 @@ struct x86_nat_target : public BaseTarget
Brian>       callback will be used.  */
Brian>    bool stopped_by_hw_breakpoint () override
Brian>    { return x86_stopped_by_hw_breakpoint (); }
Brian> +#endif /* !__OpenBSD__ */
Brian>  };

This #if also encloses the watchpoint methods.  I wasn't sure if that
was intentional.

Tom



More information about the Gdb-patches mailing list