gdbserver/linux-low: turn 'get_pc' and 'set_pc' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-xtensa-low.cc
index 32146822d4f555f34d5e790b3c966fe00be42dfc..fb680bdb965a6d24ad01278b4b4f792d8ee58169 100644 (file)
@@ -26,12 +26,59 @@ class xtensa_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;
+
+  bool low_supports_breakpoints () override;
+
+  CORE_ADDR low_get_pc (regcache *regcache) override;
+
+  void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
 };
 
 /* The singleton target ops object.  */
 
 static xtensa_target the_xtensa_target;
 
+bool
+xtensa_target::low_cannot_fetch_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
+                         "is not implemented by the target");
+}
+
+bool
+xtensa_target::low_cannot_store_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_store_register "
+                         "is not implemented by the target");
+}
+
+bool
+xtensa_target::low_supports_breakpoints ()
+{
+  return true;
+}
+
+CORE_ADDR
+xtensa_target::low_get_pc (regcache *regcache)
+{
+  return linux_get_pc_32bit (regcache);
+}
+
+void
+xtensa_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
+{
+  linux_set_pc_32bit (regcache, pc);
+}
+
 /* Defined in auto-generated file reg-xtensa.c.  */
 void init_registers_xtensa (void);
 extern const struct target_desc *tdesc_xtensa;
@@ -251,15 +298,15 @@ static struct regsets_info xtensa_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     NULL, /* usrregs */
     &xtensa_regsets_info
   };
 
-static void
-xtensa_arch_setup (void)
+void
+xtensa_target::low_arch_setup ()
 {
   current_process ()->tdesc = tdesc_xtensa;
 }
@@ -272,20 +319,13 @@ xtensa_supports_hardware_single_step (void)
   return 1;
 }
 
-static const struct regs_info *
-xtensa_regs_info (void)
+const regs_info *
+xtensa_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  xtensa_arch_setup,
-  xtensa_regs_info,
-  0,
-  0,
-  NULL, /* fetch_register */
-  linux_get_pc_32bit,
-  linux_set_pc_32bit,
   NULL, /* breakpoint_kind_from_pc */
   xtensa_sw_breakpoint_from_kind,
   NULL,
This page took 0.029966 seconds and 4 git commands to generate.