gdbserver/linux-low: turn 'regs_info' into a method
[deliverable/binutils-gdb.git] / gdbserver / linux-cris-low.cc
index 8ea5af92e31523324e2eef070ddda47f3dd390f7..dcb7d3fd5f4677cef85b4b3b20a9c3f5365d7703 100644 (file)
 #include "linux-low.h"
 #include "nat/gdb_ptrace.h"
 
+/* Linux target op definitions for the CRIS architecture.  */
+
+class cris_target : public linux_process_target
+{
+public:
+
+  const regs_info *get_regs_info () override;
+
+protected:
+
+  void low_arch_setup () override;
+};
+
+/* The singleton target ops object.  */
+
+static cris_target the_cris_target;
+
 /* Defined in auto-generated file reg-cris.c.  */
 void init_registers_cris (void);
 extern const struct target_desc *tdesc_cris;
@@ -76,8 +93,8 @@ cris_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  (*the_target->read_memory) (where, (unsigned char *) &insn,
-                             cris_breakpoint_len);
+  the_target->read_memory (where, (unsigned char *) &insn,
+                          cris_breakpoint_len);
   if (insn == cris_breakpoint)
     return 1;
 
@@ -86,8 +103,8 @@ cris_breakpoint_at (CORE_ADDR where)
   return 0;
 }
 
-static void
-cris_arch_setup (void)
+void
+cris_target::low_arch_setup ()
 {
   current_process ()->tdesc = tdesc_cris;
 }
@@ -98,21 +115,19 @@ static struct usrregs_info cris_usrregs_info =
     cris_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &cris_usrregs_info,
   };
 
-static const struct regs_info *
-cris_regs_info (void)
+const regs_info *
+cris_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  cris_arch_setup,
-  cris_regs_info,
   cris_cannot_fetch_register,
   cris_cannot_store_register,
   NULL, /* fetch_register */
@@ -125,6 +140,10 @@ struct linux_target_ops the_low_target = {
   cris_breakpoint_at,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_cris_target;
+
 void
 initialize_low_arch (void)
 {
This page took 0.024515 seconds and 4 git commands to generate.