gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-mips-low.cc
index debe115ea77dde5ba4bf3168b524c1bab22afd51..0900dc88e0b70c612ca85fb971db6020004019de 100644 (file)
@@ -31,6 +31,15 @@ class mips_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.  */
@@ -159,20 +168,12 @@ mips_read_description (void)
   return have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux;
 }
 
-static void
-mips_arch_setup (void)
+void
+mips_target::low_arch_setup ()
 {
   current_process ()->tdesc = mips_read_description ();
 }
 
-static struct usrregs_info *
-get_usrregs_info (void)
-{
-  const struct regs_info *regs_info = the_low_target.regs_info ();
-
-  return regs_info->usrregs;
-}
-
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -213,53 +214,53 @@ struct arch_lwp_info
    ZERO_REGNUM, it's always 0.  We also can not set BADVADDR, CAUSE,
    or FCRIR via ptrace().  */
 
-static int
-mips_cannot_fetch_register (int regno)
+bool
+mips_target::low_cannot_fetch_register (int regno)
 {
   const struct target_desc *tdesc;
 
-  if (get_usrregs_info ()->regmap[regno] == -1)
-    return 1;
+  if (get_regs_info ()->usrregs->regmap[regno] == -1)
+    return true;
 
   tdesc = current_process ()->tdesc;
 
   /* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR.  */
   if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "r0") == regno)
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
-static int
-mips_cannot_store_register (int regno)
+bool
+mips_target::low_cannot_store_register (int regno)
 {
   const struct target_desc *tdesc;
 
-  if (get_usrregs_info ()->regmap[regno] == -1)
-    return 1;
+  if (get_regs_info ()->usrregs->regmap[regno] == -1)
+    return true;
 
   tdesc = current_process ()->tdesc;
 
   /* On n32 we can't access 64-bit registers via PTRACE_POKEUSR.  */
   if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "r0") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "cause") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "badvaddr") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "fir") == regno)
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 static int
@@ -932,27 +933,23 @@ static struct regs_info dsp_regs_info =
     &mips_regsets_info
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &mips_usrregs_info,
     &mips_regsets_info
   };
 
-static const struct regs_info *
-mips_regs_info (void)
+const regs_info *
+mips_target::get_regs_info ()
 {
   if (have_dsp)
     return &dsp_regs_info;
   else
-    return &regs_info;
+    return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  mips_arch_setup,
-  mips_regs_info,
-  mips_cannot_fetch_register,
-  mips_cannot_store_register,
   mips_fetch_register,
   mips_get_pc,
   mips_set_pc,
This page took 0.026496 seconds and 4 git commands to generate.