gdbserver/linux-low: turn '{collect, supply}_ptrace_register' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-s390-low.cc
index ef5e8227d50b409cb29ed1968c5f9186014652ff..f7e439ac612ca26c93c4e42359f21ccfba214cfc 100644 (file)
@@ -59,6 +59,16 @@ public:
 
   const regs_info *get_regs_info () override;
 
+  const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
+  bool supports_z_point_type (char z_type) override;
+
+  void low_collect_ptrace_register (regcache *regcache, int regno,
+                                   char *buf) override;
+
+  void low_supply_ptrace_register (regcache *regcache, int regno,
+                                  const char *buf) override;
+
 protected:
 
   void low_arch_setup () override;
@@ -72,6 +82,10 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  int low_decr_pc_after_break () override;
+
+  bool low_breakpoint_at (CORE_ADDR pc) override;
 };
 
 /* The singleton target ops object.  */
@@ -179,11 +193,12 @@ s390_target::low_cannot_store_register (int regno)
   return false;
 }
 
-static void
-s390_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
+void
+s390_target::low_collect_ptrace_register (regcache *regcache, int regno,
+                                         char *buf)
 {
   int size = register_size (regcache->tdesc, regno);
-  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
+  const struct regs_info *regs_info = get_regs_info ();
   struct usrregs_info *usr = regs_info->usrregs;
   int regaddr = usr->regmap[regno];
 
@@ -225,12 +240,12 @@ s390_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
     collect_register (regcache, regno, buf);
 }
 
-static void
-s390_supply_ptrace_register (struct regcache *regcache,
-                            int regno, const char *buf)
+void
+s390_target::low_supply_ptrace_register (regcache *regcache, int regno,
+                                        const char *buf)
 {
   int size = register_size (regcache->tdesc, regno);
-  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
+  const struct regs_info *regs_info = get_regs_info ();
   struct usrregs_info *usr = regs_info->usrregs;
   int regaddr = usr->regmap[regno];
 
@@ -297,8 +312,8 @@ s390_fill_gregset (struct regcache *regcache, void *buf)
          || usr->regmap[i] > PT_ACR15)
        continue;
 
-      s390_collect_ptrace_register (regcache, i,
-                                   (char *) buf + usr->regmap[i]);
+      ((s390_target *) the_linux_target)->low_collect_ptrace_register
+       (regcache, i, (char *) buf + usr->regmap[i]);
     }
 }
 
@@ -451,10 +466,10 @@ 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;
@@ -500,6 +515,12 @@ s390_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
     }
 }
 
+int
+s390_target::low_decr_pc_after_break ()
+{
+  return s390_breakpoint_len;
+}
+
 /* Determine the word size for the given PID, in bytes.  */
 
 #ifdef __s390x__
@@ -660,8 +681,8 @@ s390_target::low_arch_setup ()
 }
 
 
-static int
-s390_breakpoint_at (CORE_ADDR pc)
+bool
+s390_target::low_breakpoint_at (CORE_ADDR pc)
 {
   unsigned char c[s390_breakpoint_len];
   read_inferior_memory (pc, c, s390_breakpoint_len);
@@ -670,17 +691,17 @@ s390_breakpoint_at (CORE_ADDR pc)
 
 /* Breakpoint/Watchpoint support.  */
 
-/* The "supports_z_point_type" linux_target_ops method.  */
+/* The "supports_z_point_type" target ops method.  */
 
-static int
-s390_supports_z_point_type (char z_type)
+bool
+s390_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
     case Z_PACKET_SW_BP:
-      return 1;
+      return true;
     default:
-      return 0;
+      return false;
     }
 }
 
@@ -2824,18 +2845,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* breakpoint_kind_from_pc */
-  s390_sw_breakpoint_from_kind,
-  NULL,
-  s390_breakpoint_len,
-  s390_breakpoint_at,
-  s390_supports_z_point_type,
-  NULL,
-  NULL,
-  NULL,
-  NULL,
-  s390_collect_ptrace_register,
-  s390_supply_ptrace_register,
   NULL, /* siginfo_fixup */
   NULL, /* new_process */
   NULL, /* delete_process */
@@ -2850,7 +2859,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.026214 seconds and 4 git commands to generate.