gdbserver/linux-low: turn 'insert_point' and 'remove_point' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-crisv32-low.cc
index 1d650e3ded96ce6a2c9b0c7b18e50ecc76406983..4d5edc570e55fed02925c6eabc51323a2cad08c9 100644 (file)
@@ -28,6 +28,10 @@ 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;
+
 protected:
 
   void low_arch_setup () override;
@@ -41,6 +45,14 @@ protected:
   CORE_ADDR low_get_pc (regcache *regcache) override;
 
   void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+  bool low_breakpoint_at (CORE_ADDR pc) override;
+
+  int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                       int size, raw_breakpoint *bp) override;
+
+  int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
+                       int size, raw_breakpoint *bp) override;
 };
 
 /* The singleton target ops object.  */
@@ -117,28 +129,27 @@ static int cris_regmap[] = {
 static const unsigned short cris_breakpoint = 0xe938;
 #define cris_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 *
-cris_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+crisv32_target::sw_breakpoint_from_kind (int kind, int *size)
 {
   *size = cris_breakpoint_len;
   return (const gdb_byte *) &cris_breakpoint;
 }
 
-static int
-cris_breakpoint_at (CORE_ADDR where)
+bool
+crisv32_target::low_breakpoint_at (CORE_ADDR where)
 {
   unsigned short insn;
 
-  the_target->read_memory (where, (unsigned char *) &insn,
-                          cris_breakpoint_len);
+  read_memory (where, (unsigned char *) &insn, cris_breakpoint_len);
   if (insn == cris_breakpoint)
-    return 1;
+    return true;
 
   /* If necessary, recognize more trap instructions here.  GDB only uses the
      one.  */
-  return 0;
+  return false;
 }
 
 static void
@@ -174,23 +185,23 @@ cris_write_data_breakpoint (struct regcache *regcache,
     }
 }
 
-static int
-cris_supports_z_point_type (char z_type)
+bool
+crisv32_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
     case Z_PACKET_WRITE_WP:
     case Z_PACKET_READ_WP:
     case Z_PACKET_ACCESS_WP:
-      return 1;
+      return true;
     default:
-      return 0;
+      return false;
     }
 }
 
-static int
-cris_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
-                  int len, struct raw_breakpoint *bp)
+int
+crisv32_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                                 int len, raw_breakpoint *bp)
 {
   int bp;
   unsigned long bp_ctrl;
@@ -261,9 +272,9 @@ cris_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   return 0;
 }
 
-static int
-cris_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int len,
-                  struct raw_breakpoint *bp)
+int
+crisv32_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
+                                 int len, raw_breakpoint *bp)
 {
   int bp;
   unsigned long bp_ctrl;
@@ -453,14 +464,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* breakpoint_kind_from_pc */
-  cris_sw_breakpoint_from_kind,
-  NULL, /* get_next_pcs */
-  0,
-  cris_breakpoint_at,
-  cris_supports_z_point_type,
-  cris_insert_point,
-  cris_remove_point,
   cris_stopped_by_watchpoint,
   cris_stopped_data_address,
   NULL, /* collect_ptrace_register */
@@ -479,7 +482,6 @@ struct linux_target_ops the_low_target = {
   NULL, /* emit_ops */
   NULL, /* get_min_fast_tracepoint_insn_len */
   NULL, /* supports_range_stepping */
-  NULL, /* breakpoint_kind_from_current_state */
   cris_supports_hardware_single_step,
 };
 
This page took 0.029581 seconds and 4 git commands to generate.