gdbserver/linux-low: turn 'get_thread_area' into a method
[deliverable/binutils-gdb.git] / gdbserver / linux-aarch64-low.cc
index 9727d5db85a26a6ffe3b6395994f0e3e3a7f92e6..c58fb44ec8a689ed4c0fe83eca037c9675b26b23 100644 (file)
@@ -65,6 +65,8 @@ public:
 
   bool supports_z_point_type (char z_type) override;
 
+  bool supports_tracepoints () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -80,6 +82,33 @@ protected:
   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;
+
+  bool low_stopped_by_watchpoint () override;
+
+  CORE_ADDR low_stopped_data_address () override;
+
+  bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                         int direction) override;
+
+  arch_process_info *low_new_process () override;
+
+  void low_delete_process (arch_process_info *info) override;
+
+  void low_new_thread (lwp_info *) override;
+
+  void low_delete_thread (arch_lwp_info *) override;
+
+  void low_new_fork (process_info *parent, process_info *child) override;
+
+  void low_prepare_to_resume (lwp_info *lwp) override;
+
+  int low_get_thread_area (int lwpid, CORE_ADDR *addrp) override;
 };
 
 /* The singleton target ops object.  */
@@ -100,6 +129,12 @@ aarch64_target::low_cannot_store_register (int regno)
                          "is not implemented by the target");
 }
 
+void
+aarch64_target::low_prepare_to_resume (lwp_info *lwp)
+{
+  aarch64_linux_prepare_to_resume (lwp);
+}
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -308,14 +343,14 @@ aarch64_target::supports_z_point_type (char z_type)
     }
 }
 
-/* Implementation of linux_target_ops method "insert_point".
+/* Implementation of linux target ops method "low_insert_point".
 
    It actually only records the info of the to-be-inserted bp/wp;
    the actual insertion will happen when threads are resumed.  */
 
-static int
-aarch64_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
-                     int len, struct raw_breakpoint *bp)
+int
+aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                                 int len, raw_breakpoint *bp)
 {
   int ret;
   enum target_hw_bp_type targ_type;
@@ -357,14 +392,14 @@ aarch64_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   return ret;
 }
 
-/* Implementation of linux_target_ops method "remove_point".
+/* Implementation of linux target ops method "low_remove_point".
 
    It actually only records the info of the to-be-removed bp/wp,
    the actual removal will be done when threads are resumed.  */
 
-static int
-aarch64_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
-                     int len, struct raw_breakpoint *bp)
+int
+aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
+                                 int len, raw_breakpoint *bp)
 {
   int ret;
   enum target_hw_bp_type targ_type;
@@ -403,10 +438,10 @@ aarch64_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   return ret;
 }
 
-/* Implementation of linux_target_ops method "stopped_data_address".  */
+/* Implementation of linux target ops method "low_stopped_data_address".  */
 
-static CORE_ADDR
-aarch64_stopped_data_address (void)
+CORE_ADDR
+aarch64_target::low_stopped_data_address ()
 {
   siginfo_t siginfo;
   int pid, i;
@@ -465,15 +500,12 @@ aarch64_stopped_data_address (void)
   return (CORE_ADDR) 0;
 }
 
-/* Implementation of linux_target_ops method "stopped_by_watchpoint".  */
+/* Implementation of linux target ops method "low_stopped_by_watchpoint".  */
 
-static int
-aarch64_stopped_by_watchpoint (void)
+bool
+aarch64_target::low_stopped_by_watchpoint ()
 {
-  if (aarch64_stopped_data_address () != 0)
-    return 1;
-  else
-    return 0;
+  return (low_stopped_data_address () != 0);
 }
 
 /* Fetch the thread-local storage pointer for libthread_db.  */
@@ -486,10 +518,11 @@ ps_get_thread_area (struct ps_prochandle *ph,
                                     is_64bit_tdesc ());
 }
 
-/* Implementation of linux_target_ops method "siginfo_fixup".  */
+/* Implementation of linux target ops method "low_siginfo_fixup".  */
 
-static int
-aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
+bool
+aarch64_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
+                                  int direction)
 {
   /* Is the inferior 32-bit?  If so, then fixup the siginfo object.  */
   if (!is_64bit_tdesc ())
@@ -501,16 +534,16 @@ aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
        aarch64_siginfo_from_compat_siginfo (native,
                                             (struct compat_siginfo *) inf);
 
-      return 1;
+      return true;
     }
 
-  return 0;
+  return false;
 }
 
-/* Implementation of linux_target_ops method "new_process".  */
+/* Implementation of linux target ops method "low_new_process".  */
 
-static struct arch_process_info *
-aarch64_linux_new_process (void)
+arch_process_info *
+aarch64_target::low_new_process ()
 {
   struct arch_process_info *info = XCNEW (struct arch_process_info);
 
@@ -519,19 +552,31 @@ aarch64_linux_new_process (void)
   return info;
 }
 
-/* Implementation of linux_target_ops method "delete_process".  */
+/* Implementation of linux target ops method "low_delete_process".  */
 
-static void
-aarch64_linux_delete_process (struct arch_process_info *info)
+void
+aarch64_target::low_delete_process (arch_process_info *info)
 {
   xfree (info);
 }
 
-/* Implementation of linux_target_ops method "linux_new_fork".  */
+void
+aarch64_target::low_new_thread (lwp_info *lwp)
+{
+  aarch64_linux_new_thread (lwp);
+}
 
-static void
-aarch64_linux_new_fork (struct process_info *parent,
-                       struct process_info *child)
+void
+aarch64_target::low_delete_thread (arch_lwp_info *arch_lwp)
+{
+  aarch64_linux_delete_thread (arch_lwp);
+}
+
+/* Implementation of linux target ops method "low_new_fork".  */
+
+void
+aarch64_target::low_new_fork (process_info *parent,
+                             process_info *child)
 {
   /* These are allocated by linux_add_process.  */
   gdb_assert (parent->priv != NULL
@@ -674,13 +719,13 @@ aarch64_target::get_regs_info ()
   return &regs_info_aarch64;
 }
 
-/* Implementation of linux_target_ops method "supports_tracepoints".  */
+/* Implementation of target ops method "supports_tracepoints".  */
 
-static int
-aarch64_supports_tracepoints (void)
+bool
+aarch64_target::supports_tracepoints ()
 {
   if (current_thread == NULL)
-    return 1;
+    return true;
   else
     {
       /* We don't support tracepoints on aarch32 now.  */
@@ -688,10 +733,10 @@ aarch64_supports_tracepoints (void)
     }
 }
 
-/* Implementation of linux_target_ops method "get_thread_area".  */
+/* Implementation of linux target ops method "low_get_thread_area".  */
 
-static int
-aarch64_get_thread_area (int lwpid, CORE_ADDR *addrp)
+int
+aarch64_target::low_get_thread_area (int lwpid, CORE_ADDR *addrp)
 {
   struct iovec iovec;
   uint64_t reg;
@@ -3106,22 +3151,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_insert_point,
-  aarch64_remove_point,
-  aarch64_stopped_by_watchpoint,
-  aarch64_stopped_data_address,
-  NULL, /* collect_ptrace_register */
-  NULL, /* supply_ptrace_register */
-  aarch64_linux_siginfo_fixup,
-  aarch64_linux_new_process,
-  aarch64_linux_delete_process,
-  aarch64_linux_new_thread,
-  aarch64_linux_delete_thread,
-  aarch64_linux_new_fork,
-  aarch64_linux_prepare_to_resume,
-  NULL, /* process_qsupported */
-  aarch64_supports_tracepoints,
-  aarch64_get_thread_area,
   aarch64_install_fast_tracepoint_jump_pad,
   aarch64_emit_ops,
   aarch64_get_min_fast_tracepoint_insn_len,
This page took 0.027562 seconds and 4 git commands to generate.