gdbserver/linux-low: turn 'supports_z_point_type' into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:27 +0000 (15:11 +0200)
gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'supports_z_point_type' linux target op and let the
concrete linux target define it by overriding the op declared in
process_stratum_target.

* linux-low.cc (linux_process_target::supports_z_point_type):
Remove.
* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <supports_z_point_type>: Remove.
* linux-x86-low.cc (class x86_target) <supports_z_point_type>:
Declare.
(x86_supports_z_point_type): Turn into...
(x86_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (class aarch64_target)
<supports_z_point_type>: Declare.
(aarch64_supports_z_point_type): Turn into...
(aarch64_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-arm-low.cc (class arm_target) <supports_z_point_type>:
Declare.
(arm_supports_z_point_type): Turn into...
(arm_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (class crisv32_target)
<supports_z_point_type>: Declare.
(cris_supports_z_point_type): Turn into...
(crisv32_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-mips-low.cc (class mips_target) <supports_z_point_type>:
Declare.
(mips_supports_z_point_type): Turn into...
(mips_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (class ppc_target) <supports_z_point_type>:
Declare.
(ppc_supports_z_point_type): Turn into...
(ppc_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-s390-low.cc (class s390_target) <supports_z_point_type>:
Declare.
(s390_supports_z_point_type): Turn into...
(s390_target::supports_z_point_type): ...this.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (the_low_target): Remove the op field.
* linux-m32r-low.cc (the_low_target): Ditto.
* linux-m68k-low.cc (the_low_target): Ditto.
* linux-sh-low.cc (the_low_target): Ditto.
* linux-sparc-low.cc (the_low_target): Ditto.
* linux-tic6x-low.cc (the_low_target): Ditto.
* linux-tile-low.cc (the_low_target): Ditto.
* linux-xtensa-low.cc (the_low_target): Ditto.

18 files changed:
gdbserver/ChangeLog
gdbserver/linux-aarch64-low.cc
gdbserver/linux-arm-low.cc
gdbserver/linux-bfin-low.cc
gdbserver/linux-crisv32-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-ppc-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 1750dbf511041730e7dce35c7e64960731b71178..5e6861af1830ddaf5f98762967f8a7ddee76ea60 100644 (file)
@@ -1,3 +1,57 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Remove the 'supports_z_point_type' linux target op and let the
+       concrete linux target define it by overriding the op declared in
+       process_stratum_target.
+
+       * linux-low.cc (linux_process_target::supports_z_point_type):
+       Remove.
+       * linux-low.h (struct linux_target_ops): Remove the op.
+       (class linux_process_target) <supports_z_point_type>: Remove.
+       * linux-x86-low.cc (class x86_target) <supports_z_point_type>:
+       Declare.
+       (x86_supports_z_point_type): Turn into...
+       (x86_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-aarch64-low.cc (class aarch64_target)
+       <supports_z_point_type>: Declare.
+       (aarch64_supports_z_point_type): Turn into...
+       (aarch64_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-arm-low.cc (class arm_target) <supports_z_point_type>:
+       Declare.
+       (arm_supports_z_point_type): Turn into...
+       (arm_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-crisv32-low.cc (class crisv32_target)
+       <supports_z_point_type>: Declare.
+       (cris_supports_z_point_type): Turn into...
+       (crisv32_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-mips-low.cc (class mips_target) <supports_z_point_type>:
+       Declare.
+       (mips_supports_z_point_type): Turn into...
+       (mips_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-ppc-low.cc (class ppc_target) <supports_z_point_type>:
+       Declare.
+       (ppc_supports_z_point_type): Turn into...
+       (ppc_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-s390-low.cc (class s390_target) <supports_z_point_type>:
+       Declare.
+       (s390_supports_z_point_type): Turn into...
+       (s390_target::supports_z_point_type): ...this.
+       (the_low_target): Remove the op field.
+       * linux-bfin-low.cc (the_low_target): Remove the op field.
+       * linux-m32r-low.cc (the_low_target): Ditto.
+       * linux-m68k-low.cc (the_low_target): Ditto.
+       * linux-sh-low.cc (the_low_target): Ditto.
+       * linux-sparc-low.cc (the_low_target): Ditto.
+       * linux-tic6x-low.cc (the_low_target): Ditto.
+       * linux-tile-low.cc (the_low_target): Ditto.
+       * linux-xtensa-low.cc (the_low_target): Ditto.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn the 'breakpoint_at' linux target op into a method of
index 2fc38748e1becaa7e429c6cbbd825a66b96fca34..9727d5db85a26a6ffe3b6395994f0e3e3a7f92e6 100644 (file)
@@ -63,6 +63,8 @@ public:
 
   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;
@@ -288,10 +290,10 @@ aarch64_get_debug_reg_state (pid_t pid)
   return &proc->priv->arch_private->debug_reg_state;
 }
 
-/* Implementation of linux_target_ops method "supports_z_point_type".  */
+/* Implementation of target ops method "supports_z_point_type".  */
 
-static int
-aarch64_supports_z_point_type (char z_type)
+bool
+aarch64_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
@@ -300,9 +302,9 @@ aarch64_supports_z_point_type (char 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;
     }
 }
 
@@ -3104,7 +3106,6 @@ aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_supports_z_point_type,
   aarch64_insert_point,
   aarch64_remove_point,
   aarch64_stopped_by_watchpoint,
index afbe0beca62380e45fdfd21b554ec66f8562bf06..2d6035cd07b9bb20b5ee0e78d375821178adc1c3 100644 (file)
@@ -70,6 +70,8 @@ public:
 
   bool supports_software_single_step () override;
 
+  bool supports_z_point_type (char z_type) override;
+
 protected:
 
   void low_arch_setup () override;
@@ -556,8 +558,8 @@ update_registers_callback (thread_info *thread, int watch, int i)
     linux_stop_lwp (lwp);
 }
 
-static int
-arm_supports_z_point_type (char z_type)
+bool
+arm_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
@@ -566,10 +568,10 @@ arm_supports_z_point_type (char z_type)
     case Z_PACKET_WRITE_WP:
     case Z_PACKET_READ_WP:
     case Z_PACKET_ACCESS_WP:
-      return 1;
+      return true;
     default:
       /* Leave the handling of sw breakpoints with the gdb client.  */
-      return 0;
+      return false;
     }
 }
 
@@ -1093,7 +1095,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  arm_supports_z_point_type,
   arm_insert_point,
   arm_remove_point,
   arm_stopped_by_watchpoint,
index 351c7ae5c973fe1fef6322bef75475649953cd18..5384fa897b89509aba306d8702aab9d4413fc413 100644 (file)
@@ -171,7 +171,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index 8d84a8d8a1f3568ca4defec940e3e6f02ddd0be7..761e4e243acb81bc397bb2de0ecee3155ff170d5 100644 (file)
@@ -30,6 +30,8 @@ public:
 
   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;
@@ -177,17 +179,17 @@ 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;
     }
 }
 
@@ -456,7 +458,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  cris_supports_z_point_type,
   cris_insert_point,
   cris_remove_point,
   cris_stopped_by_watchpoint,
index b3f87947ff682ccef100cb62b315e372d31dec61..9a5c735c5c511b1ccc8b7db8044e21db12e679bb 100644 (file)
@@ -5829,17 +5829,6 @@ linux_process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr,
   return n;
 }
 
-/* These breakpoint and watchpoint related wrapper functions simply
-   pass on the function call if the target has registered a
-   corresponding function.  */
-
-bool
-linux_process_target::supports_z_point_type (char z_type)
-{
-  return (the_low_target.supports_z_point_type != NULL
-         && the_low_target.supports_z_point_type (z_type));
-}
-
 int
 linux_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
                                    int size, raw_breakpoint *bp)
index 5dcddc41aaacd7475c966acb4bf084ec60a645ca..c80237c8aa29ad500d45a8cdf1e24b7559af194c 100644 (file)
@@ -133,7 +133,6 @@ struct linux_target_ops
 {
   /* Breakpoint and watchpoint related functions.  See target.h for
      comments.  */
-  int (*supports_z_point_type) (char z_type);
   int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
                       int size, struct raw_breakpoint *bp);
   int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
@@ -279,8 +278,6 @@ public:
   int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
                 unsigned int len) override;
 
-  bool supports_z_point_type (char z_type) override;
-
   int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
                    int size, raw_breakpoint *bp) override;
 
index f24f0425b98c083b70e30f62166882507b7759bd..2f331b4a02a51799dfc1ef9063e62b84039f2d13 100644 (file)
@@ -161,7 +161,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index 702da9589be05ed35d1e968b978c472aa340baa8..08a8f163876e0ca5d990461b00a4af76b9a29251 100644 (file)
@@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index b938473735e8b8279acaa4ce84bafe8df6fc5624..84ad0a07004c32baaff776514f43f5f3feb2776c 100644 (file)
@@ -35,6 +35,8 @@ public:
 
   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;
@@ -492,17 +494,17 @@ mips_linux_prepare_to_resume (struct lwp_info *lwp)
     }
 }
 
-static int
-mips_supports_z_point_type (char z_type)
+bool
+mips_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;
     }
 }
 
@@ -968,7 +970,6 @@ mips_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  mips_supports_z_point_type,
   mips_insert_point,
   mips_remove_point,
   mips_stopped_by_watchpoint,
index a8f51eb78e0d18c7ae1f4fb0e664d1a642c4606b..6874f0674e21530be8e40ad0fb6cb4a6ee7585a3 100644 (file)
@@ -54,6 +54,8 @@ public:
 
   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;
@@ -329,18 +331,18 @@ ppc_target::low_breakpoint_at (CORE_ADDR where)
    Handling software breakpoint at server side, so tracepoints
    and breakpoints can be inserted at the same location.  */
 
-static int
-ppc_supports_z_point_type (char z_type)
+bool
+ppc_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
     case Z_PACKET_SW_BP:
-      return 1;
+      return true;
     case Z_PACKET_HW_BP:
     case Z_PACKET_WRITE_WP:
     case Z_PACKET_ACCESS_WP:
     default:
-      return 0;
+      return false;
     }
 }
 
@@ -3408,7 +3410,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  ppc_supports_z_point_type,
   ppc_insert_point,
   ppc_remove_point,
   NULL,
index c6e0542b934ba59455b8f7bc8d528fa946d08de3..3bfa675efa40af117d48675ba6653ee94ebdcb60 100644 (file)
@@ -61,6 +61,8 @@ public:
 
   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;
@@ -682,17 +684,17 @@ s390_target::low_breakpoint_at (CORE_ADDR pc)
 
 /* Breakpoint/Watchpoint support.  */
 
-/* The "supports_z_point_type" linux_target_ops method.  */
+/* The "supports_z_point_type" target ops method.  */
 
-static int
-s390_supports_z_point_type (char z_type)
+bool
+s390_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
     case Z_PACKET_SW_BP:
-      return 1;
+      return true;
     default:
-      return 0;
+      return false;
     }
 }
 
@@ -2836,7 +2838,6 @@ s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  s390_supports_z_point_type,
   NULL,
   NULL,
   NULL,
index b88dd4695391a05a9d01ec2d8ef3b7b2a4623a40..5723b4f89040343a4b8f258d016e35a95c4103ba 100644 (file)
@@ -192,7 +192,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index c5475d270bf05caf9e5650736b2ea37bfa27114c..46133b55b592fe3fab5f1046a0c4c658cec1ecb7 100644 (file)
@@ -341,7 +341,6 @@ sparc_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL,  /* supports_z_point_type */
   NULL, NULL, NULL, NULL,
   NULL, NULL
 };
index dad8a33510be97b3d8f22230c440fe4a9ed5ccf8..30f880a19c687f040f5eb8d885d92a7ecabc5663 100644 (file)
@@ -423,7 +423,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index 49c18b157eb1aa1c082951cc3411a6378829bd25..73f3eb918e67b32435342d1d6a2d7775bd5c2c5a 100644 (file)
@@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */
index e7e6d5427d3ff52c99ba739b12f674578c456f4d..d5228746371e15acd891d0191f0070a597324758 100644 (file)
@@ -108,6 +108,8 @@ public:
 
   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;
@@ -587,8 +589,8 @@ struct x86_dr_low_type x86_dr_low =
 \f
 /* Breakpoint/Watchpoint support.  */
 
-static int
-x86_supports_z_point_type (char z_type)
+bool
+x86_target::supports_z_point_type (char z_type)
 {
   switch (z_type)
     {
@@ -596,9 +598,9 @@ x86_supports_z_point_type (char z_type)
     case Z_PACKET_HW_BP:
     case Z_PACKET_WRITE_WP:
     case Z_PACKET_ACCESS_WP:
-      return 1;
+      return true;
     default:
-      return 0;
+      return false;
     }
 }
 
@@ -2910,7 +2912,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_supports_z_point_type,
   x86_insert_point,
   x86_remove_point,
   x86_stopped_by_watchpoint,
index 19152262a126b06e02281ed09b68a68192332227..e1618d100b971fe83a6b578dc349875c9a603054 100644 (file)
@@ -329,7 +329,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* supports_z_point_type */
   NULL, /* insert_point */
   NULL, /* remove_point */
   NULL, /* stopped_by_watchpoint */