public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver/linux-low: turn 'regs_info' into a method
@ 2020-04-02 13:17 Tankut Baris Aktemur
  0 siblings, 0 replies; only message in thread
From: Tankut Baris Aktemur @ 2020-04-02 13:17 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aa8d21c9bb43baaa35f456a3d371942a26cdce4e

commit aa8d21c9bb43baaa35f456a3d371942a26cdce4e
Author: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Date:   Thu Apr 2 15:11:23 2020 +0200

    gdbserver/linux-low: turn 'regs_info' into a method
    
    gdbserver/ChangeLog:
    2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
    
            Turn the 'regs_info' linux target op into a method of
            linux_process_target.
    
            * linux-low.h (struct linux_target_ops) <regs_info>: Remove.
            (class linux_process_target) <get_regs_info>: Define.
    
            Update the callers below.
    
            * linux-low.cc (linux_process_target::fetch_registers)
            (linux_process_target::store_registers)
            * proc-service.cc (gregset_info)
    
            * linux-x86-low.cc (class x86_target) <get_regs_info>: Declare.
            (x86_linux_regs_info): Turn into ...
            (x86_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-aarch64-low.cc (class aarch64_target) <get_regs_info>:
            Declare.
            (aarch64_regs_info): Turn into ...
            (aarch64_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-arm-low.cc (class arm_target) <get_regs_info>: Declare.
            (arm_regs_info): Turn into ...
            (arm_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare.
            (bfin_regs_info): Turn into ...
            (bfin_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-cris-low.cc (class cris_target) <get_regs_info>: Declare.
            (cris_regs_info): Turn into ...
            (cris_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-crisv32-low.cc (class crisv32_target) <get_regs_info>:
            Declare.
            (crisv32_regs_info): Turn into ...
            (crisv32_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare.
            (ia64_regs_info): Turn into ...
            (ia64_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare.
            (m32r_regs_info): Turn into ...
            (m32r_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare.
            (m68k_regs_info): Turn into ...
            (m68k_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-mips-low.cc (class mips_target) <get_regs_info>: Declare.
            (mips_regs_info): Turn into ...
            (mips_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            (get_usrregs_info): Update the call to the op.
            * linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare.
            (nios2_regs_info): Turn into ...
            (nios2_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare.
            (ppc_regs_info): Turn into ...
            (ppc_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare.
            (riscv_regs_info): Turn into ...
            (riscv_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-s390-low.cc (class s390_target) <get_regs_info>: Declare.
            (s390_regs_info): Turn into ...
            (s390_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            (s390_collect_ptrace_register)
            (s390_supply_ptrace_register)
            (s390_fill_gregset): Update the call to the op.
            * linux-sh-low.cc (class sh_target) <get_regs_info>: Declare.
            (sh_regs_info): Turn into ...
            (sh_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare.
            (sparc_regs_info): Turn into ...
            (sparc_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare.
            (tic6x_regs_info): Turn into ...
            (tic6x_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-tile-low.cc (class tile_target) <get_regs_info>: Declare.
            (tile_regs_info): Turn into ...
            (tile_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.
            * linux-xtensa-low.cc (class xtensa_target) <get_regs_info>:
            Declare.
            (xtensa_regs_info): Turn into ...
            (xtensa_target::get_regs_info): ...this.
            (the_low_target): Remove the op field.

Diff:
---
 gdbserver/ChangeLog            | 98 ++++++++++++++++++++++++++++++++++++++++++
 gdbserver/linux-aarch64-low.cc |  9 ++--
 gdbserver/linux-arm-low.cc     |  7 +--
 gdbserver/linux-bfin-low.cc    | 11 ++---
 gdbserver/linux-cris-low.cc    | 11 ++---
 gdbserver/linux-crisv32-low.cc | 11 ++---
 gdbserver/linux-ia64-low.cc    | 11 ++---
 gdbserver/linux-low.cc         |  4 +-
 gdbserver/linux-low.h          |  6 ++-
 gdbserver/linux-m32r-low.cc    | 11 ++---
 gdbserver/linux-m68k-low.cc    | 11 ++---
 gdbserver/linux-mips-low.cc    | 13 +++---
 gdbserver/linux-nios2-low.cc   | 11 ++---
 gdbserver/linux-ppc-low.cc     | 11 ++---
 gdbserver/linux-riscv-low.cc   |  9 ++--
 gdbserver/linux-s390-low.cc    | 17 ++++----
 gdbserver/linux-sh-low.cc      | 11 ++---
 gdbserver/linux-sparc-low.cc   | 11 ++---
 gdbserver/linux-tic6x-low.cc   | 11 ++---
 gdbserver/linux-tile-low.cc    | 11 ++---
 gdbserver/linux-x86-low.cc     |  7 +--
 gdbserver/linux-xtensa-low.cc  | 11 ++---
 gdbserver/proc-service.cc      |  2 +-
 23 files changed, 217 insertions(+), 98 deletions(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 4a9d7bc3e4f..bbfc628a368 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,101 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+	Turn the 'regs_info' linux target op into a method of
+	linux_process_target.
+
+	* linux-low.h (struct linux_target_ops) <regs_info>: Remove.
+	(class linux_process_target) <get_regs_info>: Define.
+
+	Update the callers below.
+
+	* linux-low.cc (linux_process_target::fetch_registers)
+	(linux_process_target::store_registers)
+	* proc-service.cc (gregset_info)
+
+	* linux-x86-low.cc (class x86_target) <get_regs_info>: Declare.
+	(x86_linux_regs_info): Turn into ...
+	(x86_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-aarch64-low.cc (class aarch64_target) <get_regs_info>:
+	Declare.
+	(aarch64_regs_info): Turn into ...
+	(aarch64_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-arm-low.cc (class arm_target) <get_regs_info>: Declare.
+	(arm_regs_info): Turn into ...
+	(arm_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare.
+	(bfin_regs_info): Turn into ...
+	(bfin_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-cris-low.cc (class cris_target) <get_regs_info>: Declare.
+	(cris_regs_info): Turn into ...
+	(cris_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-crisv32-low.cc (class crisv32_target) <get_regs_info>:
+	Declare.
+	(crisv32_regs_info): Turn into ...
+	(crisv32_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare.
+	(ia64_regs_info): Turn into ...
+	(ia64_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare.
+	(m32r_regs_info): Turn into ...
+	(m32r_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare.
+	(m68k_regs_info): Turn into ...
+	(m68k_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-mips-low.cc (class mips_target) <get_regs_info>: Declare.
+	(mips_regs_info): Turn into ...
+	(mips_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	(get_usrregs_info): Update the call to the op.
+	* linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare.
+	(nios2_regs_info): Turn into ...
+	(nios2_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare.
+	(ppc_regs_info): Turn into ...
+	(ppc_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare.
+	(riscv_regs_info): Turn into ...
+	(riscv_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-s390-low.cc (class s390_target) <get_regs_info>: Declare.
+	(s390_regs_info): Turn into ...
+	(s390_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	(s390_collect_ptrace_register)
+	(s390_supply_ptrace_register)
+	(s390_fill_gregset): Update the call to the op.
+	* linux-sh-low.cc (class sh_target) <get_regs_info>: Declare.
+	(sh_regs_info): Turn into ...
+	(sh_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare.
+	(sparc_regs_info): Turn into ...
+	(sparc_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare.
+	(tic6x_regs_info): Turn into ...
+	(tic6x_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-tile-low.cc (class tile_target) <get_regs_info>: Declare.
+	(tile_regs_info): Turn into ...
+	(tile_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+	* linux-xtensa-low.cc (class xtensa_target) <get_regs_info>:
+	Declare.
+	(xtensa_regs_info): Turn into ...
+	(xtensa_target::get_regs_info): ...this.
+	(the_low_target): Remove the op field.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
 	Turn the 'arch_setup' linux target op into a method of
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 44f729386cd..ebbfbe6cba3 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -55,6 +55,8 @@ class aarch64_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -619,10 +621,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;
@@ -3065,7 +3067,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_regs_info,
   NULL, /* cannot_fetch_register */
   NULL, /* cannot_store_register */
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index 17f9549a887..c59e8bddc08 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -60,6 +60,8 @@ class arm_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -1007,8 +1009,8 @@ static struct regs_info regs_info_arm =
     &arm_regsets_info
   };
 
-static const struct regs_info *
-arm_regs_info (void)
+const regs_info *
+arm_target::get_regs_info ()
 {
   const struct target_desc *tdesc = current_process ()->tdesc;
 
@@ -1021,7 +1023,6 @@ arm_regs_info (void)
 }
 
 struct linux_target_ops the_low_target = {
-  arm_regs_info,
   arm_cannot_fetch_register,
   arm_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc
index 8656b20a932..fee79b74da1 100644
--- a/gdbserver/linux-bfin-low.cc
+++ b/gdbserver/linux-bfin-low.cc
@@ -29,6 +29,8 @@ class bfin_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -116,20 +118,19 @@ static struct usrregs_info bfin_usrregs_info =
     bfin_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &bfin_usrregs_info,
   };
 
-static const struct regs_info *
-bfin_regs_info (void)
+const regs_info *
+bfin_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  bfin_regs_info,
   bfin_cannot_fetch_register,
   bfin_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-cris-low.cc b/gdbserver/linux-cris-low.cc
index ea9dbda10e4..dcb7d3fd5f4 100644
--- a/gdbserver/linux-cris-low.cc
+++ b/gdbserver/linux-cris-low.cc
@@ -26,6 +26,8 @@ class cris_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -113,20 +115,19 @@ static struct usrregs_info cris_usrregs_info =
     cris_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &cris_usrregs_info,
   };
 
-static const struct regs_info *
-cris_regs_info (void)
+const regs_info *
+cris_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  cris_regs_info,
   cris_cannot_fetch_register,
   cris_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc
index f57be1c1529..b7763ab1356 100644
--- a/gdbserver/linux-crisv32-low.cc
+++ b/gdbserver/linux-crisv32-low.cc
@@ -26,6 +26,8 @@ class crisv32_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -395,21 +397,20 @@ static struct usrregs_info cris_usrregs_info =
     cris_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &cris_usrregs_info,
     &cris_regsets_info
   };
 
-static const struct regs_info *
-cris_regs_info (void)
+const regs_info *
+crisv32_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  cris_regs_info,
   NULL,
   NULL,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-ia64-low.cc b/gdbserver/linux-ia64-low.cc
index bccab15dcc3..d6508d2fb1d 100644
--- a/gdbserver/linux-ia64-low.cc
+++ b/gdbserver/linux-ia64-low.cc
@@ -29,6 +29,8 @@ class ia64_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -341,16 +343,16 @@ static struct usrregs_info ia64_usrregs_info =
     ia64_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &ia64_usrregs_info
   };
 
-static const struct regs_info *
-ia64_regs_info (void)
+const regs_info *
+ia64_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 void
@@ -361,7 +363,6 @@ ia64_target::low_arch_setup ()
 
 
 struct linux_target_ops the_low_target = {
-  ia64_regs_info,
   ia64_cannot_fetch_register,
   ia64_cannot_store_register,
   ia64_fetch_register,
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 55533371447..546ca731d8f 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -5576,7 +5576,7 @@ linux_process_target::fetch_registers (regcache *regcache, int regno)
 {
   int use_regsets;
   int all = 0;
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const regs_info *regs_info = get_regs_info ();
 
   if (regno == -1)
     {
@@ -5609,7 +5609,7 @@ linux_process_target::store_registers (regcache *regcache, int regno)
 {
   int use_regsets;
   int all = 0;
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const regs_info *regs_info = get_regs_info ();
 
   if (regno == -1)
     {
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 26dc831f874..697b4af53a4 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -131,8 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  const struct regs_info *(*regs_info) (void);
-
   /* Return 0 if we can fetch/store the register, 1 if we cannot
      fetch/store the register.  */
   int (*cannot_fetch_register) (int);
@@ -478,6 +476,10 @@ public:
 
   int get_ipa_tdesc_idx () override;
 
+  /* Return the information to access registers.  This has public
+     visibility because proc-service uses it.  */
+  virtual const regs_info *get_regs_info () = 0;
+
 private:
 
   /* Handle a GNU/Linux extended wait response.  If we see a clone,
diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc
index 5186cc5bdc2..2a5c6ea9bbe 100644
--- a/gdbserver/linux-m32r-low.cc
+++ b/gdbserver/linux-m32r-low.cc
@@ -29,6 +29,8 @@ class m32r_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -115,20 +117,19 @@ static struct usrregs_info m32r_usrregs_info =
     m32r_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &m32r_usrregs_info,
   };
 
-static const struct regs_info *
-m32r_regs_info (void)
+const regs_info *
+m32r_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  m32r_regs_info,
   m32r_cannot_fetch_register,
   m32r_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 667ca2ec152..cbecc7a7f52 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -25,6 +25,8 @@ class m68k_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -195,17 +197,17 @@ static struct usrregs_info m68k_usrregs_info =
     m68k_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &m68k_usrregs_info,
     &m68k_regsets_info
   };
 
-static const struct regs_info *
-m68k_regs_info (void)
+const regs_info *
+m68k_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 void
@@ -223,7 +225,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  m68k_regs_info,
   m68k_cannot_fetch_register,
   m68k_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index 53a9d75e9e2..8231217dac9 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -31,6 +31,8 @@ class mips_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -171,7 +173,7 @@ mips_target::low_arch_setup ()
 static struct usrregs_info *
 get_usrregs_info (void)
 {
-  const struct regs_info *regs_info = the_low_target.regs_info ();
+  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
 
   return regs_info->usrregs;
 }
@@ -935,24 +937,23 @@ static struct regs_info dsp_regs_info =
     &mips_regsets_info
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &mips_usrregs_info,
     &mips_regsets_info
   };
 
-static const struct regs_info *
-mips_regs_info (void)
+const regs_info *
+mips_target::get_regs_info ()
 {
   if (have_dsp)
     return &dsp_regs_info;
   else
-    return &regs_info;
+    return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  mips_regs_info,
   mips_cannot_fetch_register,
   mips_cannot_store_register,
   mips_fetch_register,
diff --git a/gdbserver/linux-nios2-low.cc b/gdbserver/linux-nios2-low.cc
index 1b680916547..2e19b8dc7de 100644
--- a/gdbserver/linux-nios2-low.cc
+++ b/gdbserver/linux-nios2-low.cc
@@ -37,6 +37,8 @@ class nios2_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -236,22 +238,21 @@ static struct usrregs_info nios2_usrregs_info =
     nios2_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &nios2_usrregs_info,
     &nios2_regsets_info
   };
 
-static const struct regs_info *
-nios2_regs_info (void)
+const regs_info *
+nios2_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target =
 {
-  nios2_regs_info,
   nios2_cannot_fetch_register,
   nios2_cannot_store_register,
   NULL,
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index fbd68830843..fe63e7bf07b 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -50,6 +50,8 @@ class ppc_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -806,17 +808,17 @@ static struct regsets_info ppc_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &ppc_usrregs_info,
     &ppc_regsets_info
   };
 
-static const struct regs_info *
-ppc_regs_info (void)
+const regs_info *
+ppc_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 void
@@ -3386,7 +3388,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  ppc_regs_info,
   ppc_cannot_fetch_register,
   ppc_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc
index 4a9cefed7b4..092f497b85a 100644
--- a/gdbserver/linux-riscv-low.cc
+++ b/gdbserver/linux-riscv-low.cc
@@ -36,6 +36,8 @@ class riscv_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -160,10 +162,10 @@ static struct regs_info riscv_regs =
     &riscv_regsets_info,
   };
 
-/* Implementation of linux_target_ops method "regs_info".  */
+/* Implementation of linux target ops method "get_regs_info".  */
 
-static const struct regs_info *
-riscv_regs_info ()
+const regs_info *
+riscv_target::get_regs_info ()
 {
   return &riscv_regs;
 }
@@ -271,7 +273,6 @@ riscv_breakpoint_at (CORE_ADDR pc)
 /* RISC-V/Linux target operations.  */
 struct linux_target_ops the_low_target =
 {
-  riscv_regs_info,
   NULL, /* cannot_fetch_register */
   NULL, /* cannot_store_register */
   riscv_fetch_register,
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index 012e2fb88f2..464f60d8d42 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -57,6 +57,8 @@ class s390_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -171,7 +173,7 @@ 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 +220,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 +278,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++)
@@ -687,7 +689,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 +716,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 +730,7 @@ s390_regs_info (void)
       return &regs_info_3264;
 #endif
     }
-  return &regs_info;
+  return &myregs_info;
 }
 
 /* The "supports_tracepoints" linux_target_ops method.  */
@@ -2806,7 +2808,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 */
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index 48b905c960b..d47cd402def 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -25,6 +25,8 @@ class sh_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -138,17 +140,17 @@ static struct usrregs_info sh_usrregs_info =
     sh_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &sh_usrregs_info,
     &sh_regsets_info
   };
 
-static const struct regs_info *
-sh_regs_info (void)
+const regs_info *
+sh_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 void
@@ -158,7 +160,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  sh_regs_info,
   sh_cannot_fetch_register,
   sh_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc
index 1ede07f4469..7be5c15c256 100644
--- a/gdbserver/linux-sparc-low.cc
+++ b/gdbserver/linux-sparc-low.cc
@@ -48,6 +48,8 @@ class sparc_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -299,21 +301,20 @@ static struct usrregs_info sparc_usrregs_info =
     NULL
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &sparc_usrregs_info,
     &sparc_regsets_info
   };
 
-static const struct regs_info *
-sparc_regs_info (void)
+const regs_info *
+sparc_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  sparc_regs_info,
   sparc_cannot_fetch_register,
   sparc_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index 47ca9883a80..1f8d2f6451e 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -44,6 +44,8 @@ class tic6x_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -387,21 +389,20 @@ static struct regsets_info tic6x_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &tic6x_usrregs_info,
     &tic6x_regsets_info
   };
 
-static const struct regs_info *
-tic6x_regs_info (void)
+const regs_info *
+tic6x_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  tic6x_regs_info,
   tic6x_cannot_fetch_register,
   tic6x_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc
index 293847efa24..6f173ccdf83 100644
--- a/gdbserver/linux-tile-low.cc
+++ b/gdbserver/linux-tile-low.cc
@@ -29,6 +29,8 @@ class tile_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -149,17 +151,17 @@ static struct usrregs_info tile_usrregs_info =
     tile_regmap,
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     &tile_usrregs_info,
     &tile_regsets_info,
   };
 
-static const struct regs_info *
-tile_regs_info (void)
+const regs_info *
+tile_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 void
@@ -190,7 +192,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  tile_regs_info,
   tile_cannot_fetch_register,
   tile_cannot_store_register,
   NULL,
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index a15d5314b2c..4fdeeef2eee 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -104,6 +104,8 @@ public:
      connected, and it may or not support xml target descriptions.  */
   void update_xmltarget ();
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -982,8 +984,8 @@ static struct regs_info i386_linux_regs_info =
     &x86_regsets_info
   };
 
-static const struct regs_info *
-x86_linux_regs_info (void)
+const regs_info *
+x86_target::get_regs_info ()
 {
 #ifdef __x86_64__
   if (is_64bit_tdesc ())
@@ -2879,7 +2881,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_linux_regs_info,
   x86_cannot_fetch_register,
   x86_cannot_store_register,
   NULL, /* fetch_register */
diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc
index a7ed08541f5..ee2cd3bd9a4 100644
--- a/gdbserver/linux-xtensa-low.cc
+++ b/gdbserver/linux-xtensa-low.cc
@@ -26,6 +26,8 @@ class xtensa_target : public linux_process_target
 {
 public:
 
+  const regs_info *get_regs_info () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -254,7 +256,7 @@ static struct regsets_info xtensa_regsets_info =
     NULL, /* disabled_regsets */
   };
 
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
   {
     NULL, /* regset_bitmap */
     NULL, /* usrregs */
@@ -275,14 +277,13 @@ xtensa_supports_hardware_single_step (void)
   return 1;
 }
 
-static const struct regs_info *
-xtensa_regs_info (void)
+const regs_info *
+xtensa_target::get_regs_info ()
 {
-  return &regs_info;
+  return &myregs_info;
 }
 
 struct linux_target_ops the_low_target = {
-  xtensa_regs_info,
   0,
   0,
   NULL, /* fetch_register */
diff --git a/gdbserver/proc-service.cc b/gdbserver/proc-service.cc
index 9c8885ea912..803c704e3f3 100644
--- a/gdbserver/proc-service.cc
+++ b/gdbserver/proc-service.cc
@@ -42,7 +42,7 @@ static struct regset_info *
 gregset_info (void)
 {
   int i = 0;
-  const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+  const regs_info *regs_info = the_linux_target->get_regs_info ();
   struct regsets_info *regsets_info = regs_info->regsets_info;
 
   while (regsets_info->regsets[i].size != -1)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-02 13:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 13:17 [binutils-gdb] gdbserver/linux-low: turn 'regs_info' into a method Tankut Baris Aktemur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).