Convert struct target_ops to C++
[deliverable/binutils-gdb.git] / gdb / amd64-fbsd-nat.c
index 07963f508d79fb47932e123f44069c52f9fc7e99..57e6ff2813b5a09fa8fdd71f56233c47954c468e 100644 (file)
 #include "fbsd-nat.h"
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
-#include "x86-bsd-nat.h"
+#include "amd64-bsd-nat.h"
 #include "x86-nat.h"
 #include "x86-xstate.h"
 \f
 
+class amd64_fbsd_nat_target final
+  : public amd64_bsd_nat_target<fbsd_nat_target>
+{
+public:
+  /* Add some extra features to the common *BSD/amd64 target.  */
+  const struct target_desc *read_description () override;
+
+#if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO)
+  int supports_stopped_by_hw_breakpoint () override;
+#endif
+};
+
+static amd64_fbsd_nat_target the_amd64_fbsd_nat_target;
+
 /* Offset in `struct reg' where MEMBER is stored.  */
 #define REG_OFFSET(member) offsetof (struct reg, member)
 
@@ -141,10 +155,10 @@ amd64fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 }
 \f
 
-/* Implement the to_read_description method.  */
+/* Implement the read_description method.  */
 
-static const struct target_desc *
-amd64fbsd_read_description (struct target_ops *ops)
+const struct target_desc *
+amd64_fbsd_nat_target::read_description ()
 {
 #ifdef PT_GETXSTATE_INFO
   static int xsave_probed;
@@ -185,20 +199,25 @@ amd64fbsd_read_description (struct target_ops *ops)
     return i386_target_description (X86_XSTATE_SSE_MASK);
 }
 
+#if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO)
+/* Implement the supports_stopped_by_hw_breakpoints method.  */
+
+int
+amd64_fbsd_nat_target::supports_stopped_by_hw_breakpoint ()
+{
+  return 1;
+}
+#endif
+
 void
 _initialize_amd64fbsd_nat (void)
 {
-  struct target_ops *t;
   int offset;
 
   amd64_native_gregset32_reg_offset = amd64fbsd32_r_reg_offset;
   amd64_native_gregset64_reg_offset = amd64fbsd64_r_reg_offset;
 
-  /* Add some extra features to the common *BSD/i386 target.  */
-  t = amd64bsd_target ();
-  t->to_read_description = amd64fbsd_read_description;
-
-  fbsd_nat_add_target (t);
+  add_target (&the_amd64_fbsd_nat_target);
 
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (amd64fbsd_supply_pcb);
This page took 0.026623 seconds and 4 git commands to generate.