gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-aarch64-low.cc
index 961fd5b3cc41c708d7acfe3c03639e287330bbb7..19484219d73d5fcb2dca675cadc946de658ea7a3 100644 (file)
 #include <sys/reg.h>
 #endif
 
+/* Linux target op definitions for the AArch64 architecture.  */
+
+class aarch64_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;
+};
+
+/* The singleton target ops object.  */
+
+static aarch64_target the_aarch64_target;
+
+bool
+aarch64_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
+aarch64_target::low_cannot_store_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_store_register "
+                         "is not implemented by the target");
+}
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -192,8 +227,8 @@ aarch64_breakpoint_at (CORE_ADDR where)
     {
       gdb_byte insn[aarch64_breakpoint_len];
 
-      (*the_target->read_memory) (where, (unsigned char *) &insn,
-                                 aarch64_breakpoint_len);
+      the_target->read_memory (where, (unsigned char *) &insn,
+                              aarch64_breakpoint_len);
       if (memcmp (insn, aarch64_breakpoint, aarch64_breakpoint_len) == 0)
        return 1;
 
@@ -503,10 +538,10 @@ aarch64_linux_new_fork (struct process_info *parent,
 /* Matches HWCAP_PACA in kernel header arch/arm64/include/uapi/asm/hwcap.h.  */
 #define AARCH64_HWCAP_PACA (1 << 30)
 
-/* Implementation of linux_target_ops method "arch_setup".  */
+/* Implementation of linux target ops method "low_arch_setup".  */
 
-static void
-aarch64_arch_setup (void)
+void
+aarch64_target::low_arch_setup ()
 {
   unsigned int machine;
   int is_elf64;
@@ -604,10 +639,10 @@ static struct regs_info regs_info_aarch64_sve =
     &aarch64_sve_regsets_info,
   };
 
-/* Implementation of linux_target_ops method "regs_info".  */
+/* Implementation of linux target ops method "get_regs_info".  */
 
-static const struct regs_info *
-aarch64_regs_info (void)
+const regs_info *
+aarch64_target::get_regs_info ()
 {
   if (!is_64bit_tdesc ())
     return &regs_info_aarch32;
@@ -3050,10 +3085,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_arch_setup,
-  aarch64_regs_info,
-  NULL, /* cannot_fetch_register */
-  NULL, /* cannot_store_register */
   NULL, /* fetch_register */
   aarch64_get_pc,
   aarch64_set_pc,
@@ -3088,6 +3119,10 @@ struct linux_target_ops the_low_target =
   aarch64_get_syscall_trapinfo,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_aarch64_target;
+
 void
 initialize_low_arch (void)
 {
This page took 0.027887 seconds and 4 git commands to generate.