Convert struct target_ops to C++
[deliverable/binutils-gdb.git] / gdb / sh-nbsd-nat.c
index d923e19799055f99f058e512af6c2822c5680db1..f776e1c07bbf9b9573bf5f5ccc518179ec31d596 100644 (file)
 #include "inf-ptrace.h"
 #include "regcache.h"
 
+struct sh_nbsd_nat_target final : public inf_ptrace_target
+{
+  void fetch_registers (struct regcache *, int) override;
+  void store_registers (struct regcache *, int) override;
+};
+
+static sh_nbsd_nat_target the_sh_nbsd_nat_target;
 
 /* Determine if PT_GETREGS fetches this register.  */
 #define GETREGS_SUPPLIES(gdbarch, regno) \
@@ -41,9 +48,8 @@
 /* Sizeof `struct reg' in <machine/reg.h>.  */
 #define SHNBSD_SIZEOF_GREGS    (21 * 4)
 
-static void
-shnbsd_fetch_inferior_registers (struct target_ops *ops,
-                                struct regcache *regcache, int regno)
+void
+sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
@@ -64,9 +70,8 @@ shnbsd_fetch_inferior_registers (struct target_ops *ops,
     }
 }
 
-static void
-shnbsd_store_inferior_registers (struct target_ops *ops,
-                                struct regcache *regcache, int regno)
+void
+sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
 {
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
@@ -94,10 +99,5 @@ shnbsd_store_inferior_registers (struct target_ops *ops,
 void
 _initialize_shnbsd_nat (void)
 {
-  struct target_ops *t;
-
-  t = inf_ptrace_target ();
-  t->to_fetch_registers = shnbsd_fetch_inferior_registers;
-  t->to_store_registers = shnbsd_store_inferior_registers;
-  add_target (t);
+  add_target (&the_sh_nbsd_nat_target);
 }
This page took 0.128615 seconds and 4 git commands to generate.