gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-tic6x-low.cc
index 51a31c7876a248a221fdc034d175714461f3d738..be6eb98b45c4edba129f9ca10d3edf57ca0c5a0d 100644 (file)
 
 #include <asm/ptrace.h>
 
+/* Linux target op definitions for the TI C6x architecture.  */
+
+class tic6x_target : public linux_process_target
+{
+public:
+
+  const regs_info *get_regs_info () override;
+
+protected:
+
+  void low_arch_setup () override;
+
+  bool low_cannot_fetch_register (int regno) override;
+
+  bool low_cannot_store_register (int regno) override;
+};
+
+/* The singleton target ops object.  */
+
+static tic6x_target the_tic6x_target;
+
 /* Defined in auto-generated file tic6x-c64xp-linux.c.  */
 void init_registers_tic6x_c64xp_linux (void);
 extern const struct target_desc *tdesc_tic6x_c64xp_linux;
@@ -206,14 +227,14 @@ tic6x_read_description (enum c6x_feature feature)
   return *tdesc;
 }
 
-static int
-tic6x_cannot_fetch_register (int regno)
+bool
+tic6x_target::low_cannot_fetch_register (int regno)
 {
   return (tic6x_regmap[regno] == -1);
 }
 
-static int
-tic6x_cannot_store_register (int regno)
+bool
+tic6x_target::low_cannot_store_register (int regno)
 {
   return (tic6x_regmap[regno] == -1);
 }
@@ -241,7 +262,7 @@ tic6x_breakpoint_at (CORE_ADDR where)
 {
   unsigned int insn;
 
-  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
+  the_target->read_memory (where, (unsigned char *) &insn, 4);
   if (insn == tic6x_breakpoint)
     return 1;
 
@@ -314,8 +335,8 @@ static struct regset_info tic6x_regsets[] = {
   NULL_REGSET
 };
 
-static void
-tic6x_arch_setup (void)
+void
+tic6x_target::low_arch_setup ()
 {
   register unsigned int csr asm ("B2");
   unsigned int cpuid;
@@ -372,24 +393,20 @@ static struct regsets_info tic6x_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &tic6x_usrregs_info,
     &tic6x_regsets_info
   };
 
-static const struct regs_info *
-tic6x_regs_info (void)
+const regs_info *
+tic6x_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  tic6x_arch_setup,
-  tic6x_regs_info,
-  tic6x_cannot_fetch_register,
-  tic6x_cannot_store_register,
   NULL, /* fetch_register */
   tic6x_get_pc,
   tic6x_set_pc,
@@ -439,6 +456,10 @@ tic6x_tdesc_test ()
 }
 #endif
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_tic6x_target;
+
 void
 initialize_low_arch (void)
 {
This page took 0.042191 seconds and 4 git commands to generate.