gdbserver/linux-low: turn 'sw_breakpoint_from_kind' into a method
[deliverable/binutils-gdb.git] / gdbserver / linux-s390-low.cc
index 012e2fb88f28ec730c5b3f03dc981720a2217fda..164142dff6e81fddcd34c3cdc666c6ca7542f200 100644 (file)
@@ -57,9 +57,23 @@ class s390_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
+  const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) 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.  */
@@ -155,23 +169,23 @@ static int s390_regmap_3264[] = {
 #endif
 
 
-static int
-s390_cannot_fetch_register (int regno)
+bool
+s390_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
-static int
-s390_cannot_store_register (int regno)
+bool
+s390_target::low_cannot_store_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 static void
 s390_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
 {
   int size = register_size (regcache->tdesc, regno);
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
   struct usrregs_info *usr = regs_info->usrregs;
   int regaddr = usr->regmap[regno];
 
@@ -218,7 +232,7 @@ s390_supply_ptrace_register (struct regcache *regcache,
                             int regno, const char *buf)
 {
   int size = register_size (regcache->tdesc, regno);
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
   struct usrregs_info *usr = regs_info->usrregs;
   int regaddr = usr->regmap[regno];
 
@@ -276,7 +290,7 @@ static void
 s390_fill_gregset (struct regcache *regcache, void *buf)
 {
   int i;
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
   struct usrregs_info *usr = regs_info->usrregs;
 
   for (i = 0; i < usr->num_regs; i++)
@@ -439,17 +453,23 @@ static struct regset_info s390_regsets[] = {
 static const gdb_byte s390_breakpoint[] = { 0, 1 };
 #define s390_breakpoint_len 2
 
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind".  */
+/* Implementation of target ops method "sw_breakpoint_from_kind".  */
 
-static const gdb_byte *
-s390_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+s390_target::sw_breakpoint_from_kind (int kind, int *size)
 {
   *size = s390_breakpoint_len;
   return s390_breakpoint;
 }
 
-static CORE_ADDR
-s390_get_pc (struct regcache *regcache)
+bool
+s390_target::low_supports_breakpoints ()
+{
+  return true;
+}
+
+CORE_ADDR
+s390_target::low_get_pc (regcache *regcache)
 {
   if (register_size (regcache->tdesc, 0) == 4)
     {
@@ -465,8 +485,8 @@ s390_get_pc (struct regcache *regcache)
     }
 }
 
-static void
-s390_set_pc (struct regcache *regcache, CORE_ADDR newpc)
+void
+s390_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
 {
   if (register_size (regcache->tdesc, 0) == 4)
     {
@@ -687,7 +707,7 @@ static struct regsets_info s390_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &s390_usrregs_info,
@@ -714,8 +734,8 @@ static struct regs_info regs_info_3264 =
     &s390_regsets_info_3264
   };
 
-static const struct regs_info *
-s390_regs_info (void)
+const regs_info *
+s390_target::get_regs_info ()
 {
   if (have_hwcap_s390_high_gprs)
     {
@@ -728,7 +748,7 @@ s390_regs_info (void)
       return &regs_info_3264;
 #endif
     }
-  return &regs_info;
+  return &myregs_info;
 }
 
 /* The "supports_tracepoints" linux_target_ops method.  */
@@ -2806,14 +2826,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  s390_regs_info,
-  s390_cannot_fetch_register,
-  s390_cannot_store_register,
-  NULL, /* fetch_register */
-  s390_get_pc,
-  s390_set_pc,
-  NULL, /* breakpoint_kind_from_pc */
-  s390_sw_breakpoint_from_kind,
   NULL,
   s390_breakpoint_len,
   s390_breakpoint_at,
@@ -2838,7 +2850,6 @@ struct linux_target_ops the_low_target = {
   s390_emit_ops,
   s390_get_min_fast_tracepoint_insn_len,
   NULL, /* supports_range_stepping */
-  NULL, /* breakpoint_kind_from_current_state */
   s390_supports_hardware_single_step,
   NULL, /* get_syscall_trapinfo */
   s390_get_ipa_tdesc_idx,
This page took 0.038614 seconds and 4 git commands to generate.