gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:24 +0000 (15:11 +0200)
gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Turn the 'cannot_fetch_register' and 'cannot_store_register'
linux target ops into methods of linux_process_target.

* linux-low.h (struct linux_target_ops): Remove the low target ops.
(class linux_process_target) <fetch_register>
<store_register>
<usr_fetch_inferior_registers>
<usr_store_inferior_registers>
<low_cannot_fetch_register>
<low_cannot_fetch_register> Declare.
* linux-low.cc (fetch_register): Turn into...
(linux_process_target::fetch_register): ...this.
(store_register): Turn into ...
(linux_process_target::store_register): ...this.
(usr_fetch_inferior_registers): Turn into...
(linux_process_target::usr_fetch_inferior_registers): ...this.
(usr_store_inferior_registers): Turn into...
(linux_process_target::usr_store_inferior_registers): ...this.
* linux-x86-low.cc (class x86_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(x86_cannot_store_register): Turn into...
(x86_target::low_cannot_store_register): ...this.
(x86_cannot_fetch_register): Turn into...
(x86_target::low_cannot_fetch_register): ...this.
(the_low_target): Remove the target op fields.
* linux-aarch64-low.cc (class aarch64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(aarch64_target::low_cannot_fetch_register)
(aarch64_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-arm-low.cc (class arm_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(arm_cannot_fetch_register): Turn into...
(arm_target::low_cannot_fetch_register): ...this.
(arm_cannot_store_register): Turn into...
(arm_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-bfin-low.cc (class bfin_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(bfin_cannot_fetch_register): Turn into...
(bfin_target::low_cannot_fetch_register): ...this.
(bfin_cannot_store_register): Turn into...
(bfin_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-cris-low.cc (class cris_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(cris_cannot_fetch_register): Turn into...
(cris_target::low_cannot_fetch_register): ...this.
(cris_cannot_store_register): Turn into...
(cris_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-crisv32-low.cc (class crisv32_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(crisv32_target::low_cannot_fetch_register)
(crisv32_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-ia64-low.cc (class ia64_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ia64_cannot_fetch_register): Turn into...
(ia64_target::low_cannot_fetch_register): ...this.
(ia64_cannot_store_register): Turn into...
(ia64_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m32r-low.cc (class m32r_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m32r_cannot_fetch_register): Turn into...
(m32r_target::low_cannot_fetch_register): ...this.
(m32r_cannot_store_register): Turn into...
(m32r_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-m68k-low.cc (class m68k_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(m68k_cannot_fetch_register): Turn into...
(m68k_target::low_cannot_fetch_register): ...this.
(m68k_cannot_store_register): Turn into...
(m68k_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-mips-low.cc (class mips_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(mips_cannot_fetch_register): Turn into...
(mips_target::low_cannot_fetch_register): ...this.
(mips_cannot_store_register): Turn into...
(mips_target::low_cannot_store_register): ...this.
(get_usrregs_info): Inline at the call sites in
low_cannot_fetch_register and low_cannot_store_register,
and remove.
(the_low_target): Remove the op fields.
* linux-nios2-low.cc (class nios2_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(nios2_cannot_fetch_register): Turn into...
(nios2_target::low_cannot_fetch_register): ...this.
(nios2_cannot_store_register): Turn into...
(nios2_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-ppc-low.cc (class ppc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(ppc_cannot_fetch_register): Turn into...
(ppc_target::low_cannot_fetch_register): ...this.
(ppc_cannot_store_register): Turn into...
(ppc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-riscv-low.cc (class riscv_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(riscv_target::low_cannot_fetch_register)
(riscv_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.
* linux-s390-low.cc (class s390_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(s390_cannot_fetch_register): Turn into...
(s390_target::low_cannot_fetch_register): ...this.
(s390_cannot_store_register): Turn into...
(s390_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sh-low.cc (class sh_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sh_cannot_fetch_register): Turn into...
(sh_target::low_cannot_fetch_register): ...this.
(sh_cannot_store_register): Turn into...
(sh_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-sparc-low.cc (class sparc_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(sparc_cannot_fetch_register): Turn into...
(sparc_target::low_cannot_fetch_register): ...this.
(sparc_cannot_store_register): Turn into...
(sparc_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tic6x-low.cc (class tic6x_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tic6x_cannot_fetch_register): Turn into...
(tic6x_target::low_cannot_fetch_register): ...this.
(tic6x_cannot_store_register): Turn into...
(tic6x_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-tile-low.cc (class tile_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(tile_cannot_fetch_register): Turn into...
(tile_target::low_cannot_fetch_register): ...this.
(tile_cannot_store_register): Turn into...
(tile_target::low_cannot_store_register): ...this.
(the_low_target): Remove the op fields.
* linux-xtensa-low.cc (class xtensa_target)
<low_cannot_fetch_register>
<low_cannot_store_register>: Declare.
(xtensa_target::low_cannot_fetch_register)
(xtensa_target::low_cannot_store_register): Define.
(the_low_target): Remove the op fields.

22 files changed:
gdbserver/ChangeLog
gdbserver/linux-aarch64-low.cc
gdbserver/linux-arm-low.cc
gdbserver/linux-bfin-low.cc
gdbserver/linux-cris-low.cc
gdbserver/linux-crisv32-low.cc
gdbserver/linux-ia64-low.cc
gdbserver/linux-low.cc
gdbserver/linux-low.h
gdbserver/linux-m32r-low.cc
gdbserver/linux-m68k-low.cc
gdbserver/linux-mips-low.cc
gdbserver/linux-nios2-low.cc
gdbserver/linux-ppc-low.cc
gdbserver/linux-riscv-low.cc
gdbserver/linux-s390-low.cc
gdbserver/linux-sh-low.cc
gdbserver/linux-sparc-low.cc
gdbserver/linux-tic6x-low.cc
gdbserver/linux-tile-low.cc
gdbserver/linux-x86-low.cc
gdbserver/linux-xtensa-low.cc

index bbfc628a3681ddf812f59841d43c57f70a583f5b..8aaca90c061c24230f1ab55e7144368cb1d4bb55 100644 (file)
@@ -1,3 +1,171 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Turn the 'cannot_fetch_register' and 'cannot_store_register'
+       linux target ops into methods of linux_process_target.
+
+       * linux-low.h (struct linux_target_ops): Remove the low target ops.
+       (class linux_process_target) <fetch_register>
+       <store_register>
+       <usr_fetch_inferior_registers>
+       <usr_store_inferior_registers>
+       <low_cannot_fetch_register>
+       <low_cannot_fetch_register> Declare.
+       * linux-low.cc (fetch_register): Turn into...
+       (linux_process_target::fetch_register): ...this.
+       (store_register): Turn into ...
+       (linux_process_target::store_register): ...this.
+       (usr_fetch_inferior_registers): Turn into...
+       (linux_process_target::usr_fetch_inferior_registers): ...this.
+       (usr_store_inferior_registers): Turn into...
+       (linux_process_target::usr_store_inferior_registers): ...this.
+       * linux-x86-low.cc (class x86_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (x86_cannot_store_register): Turn into...
+       (x86_target::low_cannot_store_register): ...this.
+       (x86_cannot_fetch_register): Turn into...
+       (x86_target::low_cannot_fetch_register): ...this.
+       (the_low_target): Remove the target op fields.
+       * linux-aarch64-low.cc (class aarch64_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (aarch64_target::low_cannot_fetch_register)
+       (aarch64_target::low_cannot_store_register): Define.
+       (the_low_target): Remove the op fields.
+       * linux-arm-low.cc (class arm_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (arm_cannot_fetch_register): Turn into...
+       (arm_target::low_cannot_fetch_register): ...this.
+       (arm_cannot_store_register): Turn into...
+       (arm_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-bfin-low.cc (class bfin_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (bfin_cannot_fetch_register): Turn into...
+       (bfin_target::low_cannot_fetch_register): ...this.
+       (bfin_cannot_store_register): Turn into...
+       (bfin_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-cris-low.cc (class cris_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (cris_cannot_fetch_register): Turn into...
+       (cris_target::low_cannot_fetch_register): ...this.
+       (cris_cannot_store_register): Turn into...
+       (cris_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-crisv32-low.cc (class crisv32_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (crisv32_target::low_cannot_fetch_register)
+       (crisv32_target::low_cannot_store_register): Define.
+       (the_low_target): Remove the op fields.
+       * linux-ia64-low.cc (class ia64_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (ia64_cannot_fetch_register): Turn into...
+       (ia64_target::low_cannot_fetch_register): ...this.
+       (ia64_cannot_store_register): Turn into...
+       (ia64_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-m32r-low.cc (class m32r_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (m32r_cannot_fetch_register): Turn into...
+       (m32r_target::low_cannot_fetch_register): ...this.
+       (m32r_cannot_store_register): Turn into...
+       (m32r_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-m68k-low.cc (class m68k_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (m68k_cannot_fetch_register): Turn into...
+       (m68k_target::low_cannot_fetch_register): ...this.
+       (m68k_cannot_store_register): Turn into...
+       (m68k_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-mips-low.cc (class mips_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (mips_cannot_fetch_register): Turn into...
+       (mips_target::low_cannot_fetch_register): ...this.
+       (mips_cannot_store_register): Turn into...
+       (mips_target::low_cannot_store_register): ...this.
+       (get_usrregs_info): Inline at the call sites in
+       low_cannot_fetch_register and low_cannot_store_register,
+       and remove.
+       (the_low_target): Remove the op fields.
+       * linux-nios2-low.cc (class nios2_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (nios2_cannot_fetch_register): Turn into...
+       (nios2_target::low_cannot_fetch_register): ...this.
+       (nios2_cannot_store_register): Turn into...
+       (nios2_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-ppc-low.cc (class ppc_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (ppc_cannot_fetch_register): Turn into...
+       (ppc_target::low_cannot_fetch_register): ...this.
+       (ppc_cannot_store_register): Turn into...
+       (ppc_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-riscv-low.cc (class riscv_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (riscv_target::low_cannot_fetch_register)
+       (riscv_target::low_cannot_store_register): Define.
+       (the_low_target): Remove the op fields.
+       * linux-s390-low.cc (class s390_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (s390_cannot_fetch_register): Turn into...
+       (s390_target::low_cannot_fetch_register): ...this.
+       (s390_cannot_store_register): Turn into...
+       (s390_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-sh-low.cc (class sh_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (sh_cannot_fetch_register): Turn into...
+       (sh_target::low_cannot_fetch_register): ...this.
+       (sh_cannot_store_register): Turn into...
+       (sh_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-sparc-low.cc (class sparc_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (sparc_cannot_fetch_register): Turn into...
+       (sparc_target::low_cannot_fetch_register): ...this.
+       (sparc_cannot_store_register): Turn into...
+       (sparc_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-tic6x-low.cc (class tic6x_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (tic6x_cannot_fetch_register): Turn into...
+       (tic6x_target::low_cannot_fetch_register): ...this.
+       (tic6x_cannot_store_register): Turn into...
+       (tic6x_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-tile-low.cc (class tile_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (tile_cannot_fetch_register): Turn into...
+       (tile_target::low_cannot_fetch_register): ...this.
+       (tile_cannot_store_register): Turn into...
+       (tile_target::low_cannot_store_register): ...this.
+       (the_low_target): Remove the op fields.
+       * linux-xtensa-low.cc (class xtensa_target)
+       <low_cannot_fetch_register>
+       <low_cannot_store_register>: Declare.
+       (xtensa_target::low_cannot_fetch_register)
+       (xtensa_target::low_cannot_store_register): Define.
+       (the_low_target): Remove the op fields.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn the 'regs_info' linux target op into a method of
index ebbfbe6cba37d6e7da01023b715a3ba403012d2e..19484219d73d5fcb2dca675cadc946de658ea7a3 100644 (file)
@@ -60,12 +60,30 @@ public:
 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
@@ -3067,8 +3085,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  NULL, /* cannot_fetch_register */
-  NULL, /* cannot_store_register */
   NULL, /* fetch_register */
   aarch64_get_pc,
   aarch64_set_pc,
index c59e8bddc08bb9ae138779883944de4d85b1d3ec..896c5fd1e64c0095431dbe9936cc28de7d210395 100644 (file)
@@ -65,6 +65,10 @@ public:
 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.  */
@@ -166,14 +170,14 @@ static struct arm_get_next_pcs_ops get_next_pcs_ops = {
   arm_linux_get_next_pcs_fixup,
 };
 
-static int
-arm_cannot_store_register (int regno)
+bool
+arm_target::low_cannot_store_register (int regno)
 {
   return (regno >= arm_num_regs);
 }
 
-static int
-arm_cannot_fetch_register (int regno)
+bool
+arm_target::low_cannot_fetch_register (int regno)
 {
   return (regno >= arm_num_regs);
 }
@@ -1023,8 +1027,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  arm_cannot_fetch_register,
-  arm_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index fee79b74da13220e4e1c4e392e11ff7cc0a6c329..e7cd1e2963775ccdf783f314a491c11ca0617972 100644 (file)
@@ -34,6 +34,10 @@ public:
 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.  */
@@ -59,14 +63,14 @@ static int bfin_regmap[] =
 
 #define bfin_num_regs ARRAY_SIZE (bfin_regmap)
 
-static int
-bfin_cannot_store_register (int regno)
+bool
+bfin_target::low_cannot_store_register (int regno)
 {
   return (regno >= bfin_num_regs);
 }
 
-static int
-bfin_cannot_fetch_register (int regno)
+bool
+bfin_target::low_cannot_fetch_register (int regno)
 {
   return (regno >= bfin_num_regs);
 }
@@ -131,8 +135,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  bfin_cannot_fetch_register,
-  bfin_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index dcb7d3fd5f4677cef85b4b3b20a9c3f5365d7703..03ca52e39e46df98c9a417567af0011aecd1f544 100644 (file)
@@ -31,6 +31,10 @@ public:
 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.  */
@@ -58,20 +62,20 @@ static int cris_regmap[] = {
 
 };
 
-static int
-cris_cannot_store_register (int regno)
+bool
+cris_target::low_cannot_store_register (int regno)
 {
   if (cris_regmap[regno] == -1)
-    return 1;
+    return true;
 
   return (regno >= cris_num_regs);
 }
 
-static int
-cris_cannot_fetch_register (int regno)
+bool
+cris_target::low_cannot_fetch_register (int regno)
 {
   if (cris_regmap[regno] == -1)
-    return 1;
+    return true;
 
   return (regno >= cris_num_regs);
 }
@@ -128,8 +132,6 @@ cris_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  cris_cannot_fetch_register,
-  cris_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index b7763ab13564a227ebf4012fbef0e0f02a1169c4..03f0aa138e2f261104d60d9eb9f08b2fd1e5bff6 100644 (file)
@@ -31,12 +31,30 @@ public:
 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 crisv32_target the_crisv32_target;
 
+bool
+crisv32_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
+crisv32_target::low_cannot_store_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_store_register "
+                         "is not implemented by the target");
+}
+
 /* Defined in auto-generated file reg-crisv32.c.  */
 void init_registers_crisv32 (void);
 extern const struct target_desc *tdesc_crisv32;
@@ -411,8 +429,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL,
-  NULL,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index d6508d2fb1de48f1808aac4f32b312037eb59166..471530a621bffff4c215811148c4d4eccae53bff 100644 (file)
@@ -34,6 +34,10 @@ public:
 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.  */
@@ -283,16 +287,16 @@ static int ia64_regmap[] =
     -1,
   };
 
-static int
-ia64_cannot_store_register (int regno)
+bool
+ia64_target::low_cannot_store_register (int regno)
 {
-  return 0;
+  return false;
 }
 
-static int
-ia64_cannot_fetch_register (int regno)
+bool
+ia64_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 /* GDB register numbers.  */
@@ -363,8 +367,6 @@ ia64_target::low_arch_setup ()
 
 
 struct linux_target_ops the_low_target = {
-  ia64_cannot_fetch_register,
-  ia64_cannot_store_register,
   ia64_fetch_register,
 };
 
index 546ca731d8f2271329191579382dc8e3a3c8f071..caa2d8dbd589ae76855c3da1e3062691e106f2b0 100644 (file)
@@ -5418,10 +5418,10 @@ register_addr (const struct usrregs_info *usrregs, int regnum)
   return addr;
 }
 
-/* Fetch one register.  */
-static void
-fetch_register (const struct usrregs_info *usrregs,
-               struct regcache *regcache, int regno)
+
+void
+linux_process_target::fetch_register (const usrregs_info *usrregs,
+                                     regcache *regcache, int regno)
 {
   CORE_ADDR regaddr;
   int i, size;
@@ -5430,7 +5430,7 @@ fetch_register (const struct usrregs_info *usrregs,
 
   if (regno >= usrregs->num_regs)
     return;
-  if ((*the_low_target.cannot_fetch_register) (regno))
+  if (low_cannot_fetch_register (regno))
     return;
 
   regaddr = register_addr (usrregs, regno);
@@ -5466,10 +5466,9 @@ fetch_register (const struct usrregs_info *usrregs,
     supply_register (regcache, regno, buf);
 }
 
-/* Store one register.  */
-static void
-store_register (const struct usrregs_info *usrregs,
-               struct regcache *regcache, int regno)
+void
+linux_process_target::store_register (const usrregs_info *usrregs,
+                                     regcache *regcache, int regno)
 {
   CORE_ADDR regaddr;
   int i, size;
@@ -5478,7 +5477,7 @@ store_register (const struct usrregs_info *usrregs,
 
   if (regno >= usrregs->num_regs)
     return;
-  if ((*the_low_target.cannot_store_register) (regno))
+  if (low_cannot_store_register (regno))
     return;
 
   regaddr = register_addr (usrregs, regno);
@@ -5514,22 +5513,21 @@ store_register (const struct usrregs_info *usrregs,
          if (errno == ESRCH)
            return;
 
-         if ((*the_low_target.cannot_store_register) (regno) == 0)
+
+         if (!low_cannot_store_register (regno))
            error ("writing register %d: %s", regno, safe_strerror (errno));
        }
       regaddr += sizeof (PTRACE_XFER_TYPE);
     }
 }
+#endif /* HAVE_LINUX_USRREGS */
 
-/* Fetch all registers, or just one, from the child process.
-   If REGNO is -1, do this for all registers, skipping any that are
-   assumed to have been retrieved by regsets_fetch_inferior_registers,
-   unless ALL is non-zero.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-static void
-usr_fetch_inferior_registers (const struct regs_info *regs_info,
-                             struct regcache *regcache, int regno, int all)
+void
+linux_process_target::usr_fetch_inferior_registers (const regs_info *regs_info,
+                                                   regcache *regcache,
+                                                   int regno, int all)
 {
+#ifdef HAVE_LINUX_USRREGS
   struct usrregs_info *usr = regs_info->usrregs;
 
   if (regno == -1)
@@ -5540,17 +5538,15 @@ usr_fetch_inferior_registers (const struct regs_info *regs_info,
     }
   else
     fetch_register (usr, regcache, regno);
+#endif
 }
 
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers, skipping any that are
-   assumed to have been saved by regsets_store_inferior_registers,
-   unless ALL is non-zero.
-   Otherwise, REGNO specifies which register (so we can save time).  */
-static void
-usr_store_inferior_registers (const struct regs_info *regs_info,
-                             struct regcache *regcache, int regno, int all)
+void
+linux_process_target::usr_store_inferior_registers (const regs_info *regs_info,
+                                                   regcache *regcache,
+                                                   int regno, int all)
 {
+#ifdef HAVE_LINUX_USRREGS
   struct usrregs_info *usr = regs_info->usrregs;
 
   if (regno == -1)
@@ -5561,15 +5557,8 @@ usr_store_inferior_registers (const struct regs_info *regs_info,
     }
   else
     store_register (usr, regcache, regno);
-}
-
-#else /* !HAVE_LINUX_USRREGS */
-
-#define usr_fetch_inferior_registers(regs_info, regcache, regno, all) do {} while (0)
-#define usr_store_inferior_registers(regs_info, regcache, regno, all) do {} while (0)
-
 #endif
-
+}
 
 void
 linux_process_target::fetch_registers (regcache *regcache, int regno)
index 697b4af53a4f3ac79b94dfb0691b22cc4d9c2265..65c570e06692bdae7dc1b4b7f72c74d6340fdeb2 100644 (file)
@@ -131,11 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  /* Return 0 if we can fetch/store the register, 1 if we cannot
-     fetch/store the register.  */
-  int (*cannot_fetch_register) (int);
-  int (*cannot_store_register) (int);
-
   /* Hook to fetch a register in some non-standard way.  Used for
      example by backends that have read-only registers with hardcoded
      values (e.g., IA64's gr0/fr0/fr1).  Returns true if register
@@ -566,11 +561,43 @@ private:
   /* Call low_arch_setup on THREAD.  */
   void arch_setup_thread (thread_info *thread);
 
+#ifdef HAVE_LINUX_USRREGS
+  /* Fetch one register.  */
+  void fetch_register (const usrregs_info *usrregs, regcache *regcache,
+                      int regno);
+
+  /* Store one register.  */
+  void store_register (const usrregs_info *usrregs, regcache *regcache,
+                      int regno);
+#endif
+
+  /* Fetch all registers, or just one, from the child process.
+     If REGNO is -1, do this for all registers, skipping any that are
+     assumed to have been retrieved by regsets_fetch_inferior_registers,
+     unless ALL is non-zero.
+     Otherwise, REGNO specifies which register (so we can save time).  */
+  void usr_fetch_inferior_registers (const regs_info *regs_info,
+                                    regcache *regcache, int regno, int all);
+
+  /* Store our register values back into the inferior.
+     If REGNO is -1, do this for all registers, skipping any that are
+     assumed to have been saved by regsets_store_inferior_registers,
+     unless ALL is non-zero.
+     Otherwise, REGNO specifies which register (so we can save time).  */
+  void usr_store_inferior_registers (const regs_info *regs_info,
+                                    regcache *regcache, int regno, int all);
+
 protected:
   /* The architecture-specific "low" methods are listed below.  */
 
   /* Architecture-specific setup for the current thread.  */
   virtual void low_arch_setup () = 0;
+
+  /* Return false if we can fetch/store the register, true if we cannot
+     fetch/store the register.  */
+  virtual bool low_cannot_fetch_register (int regno) = 0;
+
+  virtual bool low_cannot_store_register (int regno) = 0;
 };
 
 extern linux_process_target *the_linux_target;
index 2a5c6ea9bbe5a2b4e9a300b64577642f1d457372..912708db817e0fe9ed7c10e68d48e769b97271fc 100644 (file)
@@ -34,6 +34,10 @@ public:
 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.  */
@@ -58,14 +62,14 @@ static int m32r_regmap[] = {
 #endif
 };
 
-static int
-m32r_cannot_store_register (int regno)
+bool
+m32r_target::low_cannot_store_register (int regno)
 {
   return (regno >= m32r_num_regs);
 }
 
-static int
-m32r_cannot_fetch_register (int regno)
+bool
+m32r_target::low_cannot_fetch_register (int regno)
 {
   return (regno >= m32r_num_regs);
 }
@@ -130,8 +134,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  m32r_cannot_fetch_register,
-  m32r_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index cbecc7a7f525976329d9ff05cae987eb186fa87e..08545aa946fb7f7835337e8112e3db9df03f8cb7 100644 (file)
@@ -30,6 +30,10 @@ public:
 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.  */
@@ -71,14 +75,14 @@ static int m68k_regmap[] =
 #endif
 };
 
-static int
-m68k_cannot_store_register (int regno)
+bool
+m68k_target::low_cannot_store_register (int regno)
 {
   return (regno >= m68k_num_regs);
 }
 
-static int
-m68k_cannot_fetch_register (int regno)
+bool
+m68k_target::low_cannot_fetch_register (int regno)
 {
   return (regno >= m68k_num_regs);
 }
@@ -225,8 +229,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  m68k_cannot_fetch_register,
-  m68k_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index 8231217dac9acde7d2d4d90812bacf5da08dd9fc..0900dc88e0b70c612ca85fb971db6020004019de 100644 (file)
@@ -36,6 +36,10 @@ public:
 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.  */
@@ -170,14 +174,6 @@ mips_target::low_arch_setup ()
   current_process ()->tdesc = mips_read_description ();
 }
 
-static struct usrregs_info *
-get_usrregs_info (void)
-{
-  const struct regs_info *regs_info = the_linux_target->get_regs_info ();
-
-  return regs_info->usrregs;
-}
-
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -218,53 +214,53 @@ struct arch_lwp_info
    ZERO_REGNUM, it's always 0.  We also can not set BADVADDR, CAUSE,
    or FCRIR via ptrace().  */
 
-static int
-mips_cannot_fetch_register (int regno)
+bool
+mips_target::low_cannot_fetch_register (int regno)
 {
   const struct target_desc *tdesc;
 
-  if (get_usrregs_info ()->regmap[regno] == -1)
-    return 1;
+  if (get_regs_info ()->usrregs->regmap[regno] == -1)
+    return true;
 
   tdesc = current_process ()->tdesc;
 
   /* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR.  */
   if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "r0") == regno)
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
-static int
-mips_cannot_store_register (int regno)
+bool
+mips_target::low_cannot_store_register (int regno)
 {
   const struct target_desc *tdesc;
 
-  if (get_usrregs_info ()->regmap[regno] == -1)
-    return 1;
+  if (get_regs_info ()->usrregs->regmap[regno] == -1)
+    return true;
 
   tdesc = current_process ()->tdesc;
 
   /* On n32 we can't access 64-bit registers via PTRACE_POKEUSR.  */
   if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "r0") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "cause") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "badvaddr") == regno)
-    return 1;
+    return true;
 
   if (find_regno (tdesc, "fir") == regno)
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 static int
@@ -954,8 +950,6 @@ mips_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  mips_cannot_fetch_register,
-  mips_cannot_store_register,
   mips_fetch_register,
   mips_get_pc,
   mips_set_pc,
index 2e19b8dc7de7041b27c3fecb1ccd4ca78fc79b1e..adbb0f2622e002c7dece2a0bc0c391776198f60f 100644 (file)
@@ -42,6 +42,10 @@ public:
 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.  */
@@ -90,26 +94,20 @@ nios2_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_nios2_linux;
 }
 
-/* Implement the cannot_fetch_register linux_target_ops method.  */
+/* Implement the low_cannot_fetch_register linux target ops method.  */
 
-static int
-nios2_cannot_fetch_register (int regno)
+bool
+nios2_target::low_cannot_fetch_register (int regno)
 {
-  if (nios2_regmap[regno] == -1)
-    return 1;
-
-  return 0;
+  return (nios2_regmap[regno] == -1);
 }
 
-/* Implement the cannot_store_register linux_target_ops method.  */
+/* Implement the low_cannot_store_register linux target ops method.  */
 
-static int
-nios2_cannot_store_register (int regno)
+bool
+nios2_target::low_cannot_store_register (int regno)
 {
-  if (nios2_regmap[regno] == -1)
-    return 1;
-
-  return 0;
+  return (nios2_regmap[regno] == -1);
 }
 
 /* Breakpoint support.  Also see comments on nios2_breakpoint_from_pc
@@ -253,8 +251,6 @@ nios2_target::get_regs_info ()
 
 struct linux_target_ops the_low_target =
 {
-  nios2_cannot_fetch_register,
-  nios2_cannot_store_register,
   NULL,
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index fe63e7bf07b767479bdf9547e88e60e469633563..968538df3703bdee735128c058a00fa9df17a65b 100644 (file)
@@ -55,6 +55,10 @@ public:
 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.  */
@@ -160,8 +164,8 @@ ppc_check_regset (int tid, int regset_id, int regsetsize)
   return 0;
 }
 
-static int
-ppc_cannot_store_register (int regno)
+bool
+ppc_target::low_cannot_store_register (int regno)
 {
   const struct target_desc *tdesc = current_process ()->tdesc;
 
@@ -169,21 +173,21 @@ ppc_cannot_store_register (int regno)
   /* Some kernels do not allow us to store fpscr.  */
   if (!(ppc_hwcap & PPC_FEATURE_HAS_SPE)
       && regno == find_regno (tdesc, "fpscr"))
-    return 1;
+    return true;
 #endif
 
   /* Some kernels do not allow us to store orig_r3 or trap.  */
   if (regno == find_regno (tdesc, "orig_r3")
       || regno == find_regno (tdesc, "trap"))
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
-static int
-ppc_cannot_fetch_register (int regno)
+bool
+ppc_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 static void
@@ -3388,8 +3392,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  ppc_cannot_fetch_register,
-  ppc_cannot_store_register,
   NULL, /* fetch_register */
   ppc_get_pc,
   ppc_set_pc,
index 092f497b85ab95066650071f59118892833d4f80..4f2e28beafced2135379b4bf068f9fbae61dd727 100644 (file)
@@ -41,12 +41,30 @@ public:
 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 riscv_target the_riscv_target;
 
+bool
+riscv_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
+riscv_target::low_cannot_store_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_store_register "
+                         "is not implemented by the target");
+}
+
 /* Implementation of linux target ops method "low_arch_setup".  */
 
 void
@@ -273,8 +291,6 @@ riscv_breakpoint_at (CORE_ADDR pc)
 /* RISC-V/Linux target operations.  */
 struct linux_target_ops the_low_target =
 {
-  NULL, /* cannot_fetch_register */
-  NULL, /* cannot_store_register */
   riscv_fetch_register,
   riscv_get_pc,
   riscv_set_pc,
index 464f60d8d42b80822360725047ef84aaa5395121..2ba0dec0551113511fd7c29d74999813bfbc414f 100644 (file)
@@ -62,6 +62,10 @@ public:
 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.  */
@@ -157,16 +161,16 @@ static int s390_regmap_3264[] = {
 #endif
 
 
-static int
-s390_cannot_fetch_register (int regno)
+bool
+s390_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
-static int
-s390_cannot_store_register (int regno)
+bool
+s390_target::low_cannot_store_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 static void
@@ -2808,8 +2812,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  s390_cannot_fetch_register,
-  s390_cannot_store_register,
   NULL, /* fetch_register */
   s390_get_pc,
   s390_set_pc,
index d47cd402def1f4c71e586f0d3cdcd479400d515f..b4fd534547e755ad449a9eac3a8da5ab13e64a9b 100644 (file)
@@ -30,6 +30,10 @@ public:
 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.  */
@@ -63,16 +67,16 @@ static int sh_regmap[] = {
  REG_FPREG0*4+48,  REG_FPREG0*4+52,  REG_FPREG0*4+56,  REG_FPREG0*4+60,
 };
 
-static int
-sh_cannot_store_register (int regno)
+bool
+sh_target::low_cannot_store_register (int regno)
 {
-  return 0;
+  return false;
 }
 
-static int
-sh_cannot_fetch_register (int regno)
+bool
+sh_target::low_cannot_fetch_register (int regno)
 {
-  return 0;
+  return false;
 }
 
 /* Correct in either endianness, obviously.  */
@@ -160,8 +164,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  sh_cannot_fetch_register,
-  sh_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,
index 7be5c15c25620aecd65f717d7a2dca6f38b383e0..4e0d930f800d96f8608fe02eb64e893346cba9a1 100644 (file)
@@ -53,6 +53,10 @@ public:
 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.  */
@@ -119,14 +123,14 @@ static const struct regs_range_t fpregs_ranges[] = {
 void init_registers_sparc64 (void);
 extern const struct target_desc *tdesc_sparc64;
 
-static int
-sparc_cannot_store_register (int regno)
+bool
+sparc_target::low_cannot_store_register (int regno)
 {
   return (regno >= sparc_num_regs || sparc_regmap[regno] == -1);
 }
 
-static int
-sparc_cannot_fetch_register (int regno)
+bool
+sparc_target::low_cannot_fetch_register (int regno)
 {
   return (regno >= sparc_num_regs || sparc_regmap[regno] == -1);
 }
@@ -315,8 +319,6 @@ sparc_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  sparc_cannot_fetch_register,
-  sparc_cannot_store_register,
   NULL, /* fetch_register */
   linux_get_pc_64bit,
   /* No sparc_set_pc is needed.  */
index 1f8d2f6451e31d8444bb6e9c4642bb7ddf69a6f7..be6eb98b45c4edba129f9ca10d3edf57ca0c5a0d 100644 (file)
@@ -49,6 +49,10 @@ public:
 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.  */
@@ -223,14 +227,14 @@ tic6x_read_description (enum c6x_feature feature)
   return *tdesc;
 }
 
-static int
-tic6x_cannot_fetch_register (int regno)
+bool
+tic6x_target::low_cannot_fetch_register (int regno)
 {
   return (tic6x_regmap[regno] == -1);
 }
 
-static int
-tic6x_cannot_store_register (int regno)
+bool
+tic6x_target::low_cannot_store_register (int regno)
 {
   return (tic6x_regmap[regno] == -1);
 }
@@ -403,8 +407,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  tic6x_cannot_fetch_register,
-  tic6x_cannot_store_register,
   NULL, /* fetch_register */
   tic6x_get_pc,
   tic6x_set_pc,
index 6f173ccdf83d85b392998d79d76a4ddff8d60f82..b9af7af7fb56fd76547c094e520f568e2bfb9fcd 100644 (file)
@@ -34,6 +34,10 @@ public:
 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.  */
@@ -63,26 +67,26 @@ static int tile_regmap[] =
   56
 };
 
-static int
-tile_cannot_fetch_register (int regno)
+bool
+tile_target::low_cannot_fetch_register (int regno)
 {
   if (regno >= 0 && regno < 56)
-    return 0;
+    return false;
   else if (regno == 64)
-    return 0;
+    return false;
   else
-    return 1;
+    return true;
 }
 
-static int
-tile_cannot_store_register (int regno)
+bool
+tile_target::low_cannot_store_register (int regno)
 {
   if (regno >= 0 && regno < 56)
-    return 0;
+    return false;
   else if (regno == 64)
-    return 0;
+    return false;
   else
-    return 1;
+    return true;
 }
 
 static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
@@ -192,8 +196,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  tile_cannot_fetch_register,
-  tile_cannot_store_register,
   NULL,
   linux_get_pc_64bit,
   linux_set_pc_64bit,
index 4fdeeef2eeebe971f0ad768a9ec9e839ea96185a..8c9ab733ea88c7a684705a5355e892cf3eab3aa8 100644 (file)
@@ -109,6 +109,10 @@ public:
 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.  */
@@ -301,23 +305,23 @@ x86_get_thread_area (int lwpid, CORE_ADDR *addr)
 
 
 \f
-static int
-x86_cannot_store_register (int regno)
+bool
+x86_target::low_cannot_store_register (int regno)
 {
 #ifdef __x86_64__
   if (is_64bit_tdesc ())
-    return 0;
+    return false;
 #endif
 
   return regno >= I386_NUM_REGS;
 }
 
-static int
-x86_cannot_fetch_register (int regno)
+bool
+x86_target::low_cannot_fetch_register (int regno)
 {
 #ifdef __x86_64__
   if (is_64bit_tdesc ())
-    return 0;
+    return false;
 #endif
 
   return regno >= I386_NUM_REGS;
@@ -2881,8 +2885,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_cannot_fetch_register,
-  x86_cannot_store_register,
   NULL, /* fetch_register */
   x86_get_pc,
   x86_set_pc,
index ee2cd3bd9a46fccfb4332c6ed373f73b14cc7494..876c2ad63e0d1960b0ac5bd03917baf7ce3e0ba9 100644 (file)
@@ -31,12 +31,30 @@ public:
 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 xtensa_target the_xtensa_target;
 
+bool
+xtensa_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
+xtensa_target::low_cannot_store_register (int regno)
+{
+  gdb_assert_not_reached ("linux target op low_cannot_store_register "
+                         "is not implemented by the target");
+}
+
 /* Defined in auto-generated file reg-xtensa.c.  */
 void init_registers_xtensa (void);
 extern const struct target_desc *tdesc_xtensa;
@@ -284,8 +302,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  0,
-  0,
   NULL, /* fetch_register */
   linux_get_pc_32bit,
   linux_set_pc_32bit,