gdbserver/linux-low: turn 'supports_hardware_single_step' into a method
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 2 Apr 2020 13:11:31 +0000 (15:11 +0200)
All the linux low targets except arm define the
'supports_hardware_single_step' op to return true.  Hence, we override
the method to return true in linux_process_target, and remove the
definitions in all the linux low targets but arm.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

Remove the 'supports_hardware_single_step' linux target op and
override the process_stratum_target's op definition in
linux_process_target to return true.

* linux-low.h (struct linux_target_ops): Remove the op.
(class linux_process_target) <finish_step_over>
<maybe_hw_step>: Declare.
* linux-low.cc (can_hardware_single_step): Remove.
(maybe_hw_step): Turn into...
(linux_process_target::maybe_hw_step): ...this.
(finish_step_over): Turn into...
(linux_process_target::finish_step_over): ...this.
(linux_process_target::supports_hardware_single_step): Update
to return true.

Update the callers below.

(linux_process_target::single_step)
(linux_process_target::resume_one_lwp_throw)

* linux-arm-low.cc (class arm_target)
<supports_hardware_single_step>: Declare.
(arm_supports_hardware_single_step): Turn into...
(arm_target::supports_hardware_single_step): ...this.
(the_low_target): Remove the op field.
* linux-x86-low.cc (x86_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-aarch64-low.cc (aarch64_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.
* linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-s390-low.cc (s390_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-sh-low.cc (sh_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-tile-low.cc (tile_supports_hardware_single_step): Remove.
(the_low_target): Remove the op field.
* linux-xtensa-low.cc (xtensa_supports_hardware_single_step):
Remove.
(the_low_target): Remove the op field.

16 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-ppc-low.cc
gdbserver/linux-s390-low.cc
gdbserver/linux-sh-low.cc
gdbserver/linux-tic6x-low.cc
gdbserver/linux-tile-low.cc
gdbserver/linux-x86-low.cc
gdbserver/linux-xtensa-low.cc

index 31901878e2eead95dd8839da7ec938727e3a1d46..9f14c57933e0686cd6431389c8bd3b92986e0bdc 100644 (file)
@@ -1,3 +1,57 @@
+2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
+
+       Remove the 'supports_hardware_single_step' linux target op and
+       override the process_stratum_target's op definition in
+       linux_process_target to return true.
+
+       * linux-low.h (struct linux_target_ops): Remove the op.
+       (class linux_process_target) <finish_step_over>
+       <maybe_hw_step>: Declare.
+       * linux-low.cc (can_hardware_single_step): Remove.
+       (maybe_hw_step): Turn into...
+       (linux_process_target::maybe_hw_step): ...this.
+       (finish_step_over): Turn into...
+       (linux_process_target::finish_step_over): ...this.
+       (linux_process_target::supports_hardware_single_step): Update
+       to return true.
+
+       Update the callers below.
+
+       (linux_process_target::single_step)
+       (linux_process_target::resume_one_lwp_throw)
+
+       * linux-arm-low.cc (class arm_target)
+       <supports_hardware_single_step>: Declare.
+       (arm_supports_hardware_single_step): Turn into...
+       (arm_target::supports_hardware_single_step): ...this.
+       (the_low_target): Remove the op field.
+       * linux-x86-low.cc (x86_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-aarch64-low.cc (aarch64_supports_hardware_single_step):
+       Remove.
+       (the_low_target): Remove the op field.
+       * linux-bfin-low.cc (bfin_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-crisv32-low.cc (cris_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-m32r-low.cc (m32r_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-m68k-low.cc (m68k_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-ppc-low.cc (ppc_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-s390-low.cc (s390_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-sh-low.cc (sh_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-tic6x-low.cc (tic6x_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-tile-low.cc (tile_supports_hardware_single_step): Remove.
+       (the_low_target): Remove the op field.
+       * linux-xtensa-low.cc (xtensa_supports_hardware_single_step):
+       Remove.
+       (the_low_target): Remove the op field.
+
 2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 
        Turn the 'supports_range_stepping' linux target op into a method
index b23f1c8e1f2b19edf981b9148c29f68fe172bbfa..4f7c2578eb8938bb434e9dd0149f354b3f7a9b91 100644 (file)
@@ -3157,17 +3157,8 @@ aarch64_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
     return arm_breakpoint_kind_from_current_state (pcptr);
 }
 
-/* Support for hardware single step.  */
-
-static int
-aarch64_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 struct linux_target_ops the_low_target =
 {
-  aarch64_supports_hardware_single_step,
   aarch64_get_syscall_trapinfo,
 };
 
index a7d5261d2e22cfc1ed5dedcb9f99154f1c6c2bad..2e3d00a489afd94a40398f60e7fbbf7b1ce5a4a0 100644 (file)
@@ -72,6 +72,8 @@ public:
 
   bool supports_z_point_type (char z_type) override;
 
+  bool supports_hardware_single_step () override;
+
 protected:
 
   void low_arch_setup () override;
@@ -1030,10 +1032,10 @@ arm_target::low_get_next_pcs (regcache *regcache)
 
 /* Support for hardware single step.  */
 
-static int
-arm_supports_hardware_single_step (void)
+bool
+arm_target::supports_hardware_single_step ()
 {
-  return 0;
+  return false;
 }
 
 /* Implementation of linux_target_ops method "get_syscall_trapinfo".  */
@@ -1117,7 +1119,6 @@ arm_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  arm_supports_hardware_single_step,
   arm_get_syscall_trapinfo,
 };
 
index 3b241249173802ce5c78008e768b062c1acfdc63..b83af96a85c67c209078b7496e5d7570a2f712f7 100644 (file)
@@ -144,14 +144,6 @@ bfin_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_bfin;
 }
 
-/* Support for hardware single step.  */
-
-static int
-bfin_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct usrregs_info bfin_usrregs_info =
   {
     bfin_num_regs,
@@ -171,7 +163,6 @@ bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  bfin_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index 8850e73b7e1612225068a7c5ab9a71f5827cd84a..f662510370529baec8f962c6785c4801c7d54f72 100644 (file)
@@ -426,14 +426,6 @@ crisv32_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_crisv32;
 }
 
-/* Support for hardware single step.  */
-
-static int
-cris_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct regset_info cris_regsets[] = {
   { PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
     GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
@@ -468,7 +460,6 @@ crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  cris_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index 7ec01f473aa57601906954f5c79f066ecb321d68..56615430b59e1d8291fe191db5dcd7b478455aae 100644 (file)
@@ -270,7 +270,6 @@ static int stabilizing_threads;
 static void unsuspend_all_lwps (struct lwp_info *except);
 static void mark_lwp_dead (struct lwp_info *lwp, int wstat);
 static int lwp_is_marked_dead (struct lwp_info *lwp);
-static int finish_step_over (struct lwp_info *lwp);
 static int kill_lwp (unsigned long lwpid, int signo);
 static void enqueue_pending_signal (struct lwp_info *lwp, int signal, siginfo_t *info);
 static int linux_low_ptrace_options (int attached);
@@ -280,17 +279,6 @@ static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp);
    being stepped.  */
 ptid_t step_over_bkpt;
 
-/* True if the low target can hardware single-step.  */
-
-static int
-can_hardware_single_step (void)
-{
-  if (the_low_target.supports_hardware_single_step != NULL)
-    return the_low_target.supports_hardware_single_step ();
-  else
-    return 0;
-}
-
 bool
 linux_process_target::low_supports_breakpoints ()
 {
@@ -2503,19 +2491,17 @@ linux_process_target::filter_event (int lwpid, int wstat)
   return child;
 }
 
-/* Return true if THREAD is doing hardware single step.  */
-
-static int
-maybe_hw_step (struct thread_info *thread)
+bool
+linux_process_target::maybe_hw_step (thread_info *thread)
 {
-  if (can_hardware_single_step ())
-    return 1;
+  if (supports_hardware_single_step ())
+    return true;
   else
     {
       /* GDBserver must insert single-step breakpoint for software
         single step.  */
       gdb_assert (has_single_step_breakpoints (thread));
-      return 0;
+      return false;
     }
 }
 
@@ -4107,7 +4093,7 @@ linux_process_target::single_step (lwp_info* lwp)
 {
   int step = 0;
 
-  if (can_hardware_single_step ())
+  if (supports_hardware_single_step ())
     {
       step = 1;
     }
@@ -4218,7 +4204,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
        debug_printf ("  pending reinsert at 0x%s\n",
                      paddress (lwp->bp_reinsert));
 
-      if (can_hardware_single_step ())
+      if (supports_hardware_single_step ())
        {
          if (fast_tp_collecting == fast_tpoint_collect_result::not_collecting)
            {
@@ -4247,7 +4233,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
                      " single-stepping\n",
                      lwpid_of (thread));
 
-      if (can_hardware_single_step ())
+      if (supports_hardware_single_step ())
        step = 1;
       else
        {
@@ -4700,12 +4686,8 @@ linux_process_target::start_step_over (lwp_info *lwp)
   step_over_bkpt = thread->id;
 }
 
-/* Finish a step-over.  Reinsert the breakpoint we had uninserted in
-   start_step_over, if still there, and delete any single-step
-   breakpoints we've set, on non hardware single-step targets.  */
-
-static int
-finish_step_over (struct lwp_info *lwp)
+bool
+linux_process_target::finish_step_over (lwp_info *lwp)
 {
   if (lwp->bp_reinsert != 0)
     {
@@ -4728,7 +4710,7 @@ finish_step_over (struct lwp_info *lwp)
         and later not being able to explain it, because we were
         stepping over a breakpoint, and we hold all threads but
         LWP stopped while doing that.  */
-      if (!can_hardware_single_step ())
+      if (!supports_hardware_single_step ())
        {
          gdb_assert (has_single_step_breakpoints (current_thread));
          delete_single_step_breakpoints (current_thread);
@@ -4736,10 +4718,10 @@ finish_step_over (struct lwp_info *lwp)
 
       step_over_bkpt = null_ptid;
       current_thread = saved_thread;
-      return 1;
+      return true;
     }
   else
-    return 0;
+    return false;
 }
 
 void
@@ -5899,7 +5881,7 @@ linux_process_target::supports_stopped_by_hw_breakpoint ()
 bool
 linux_process_target::supports_hardware_single_step ()
 {
-  return can_hardware_single_step ();
+  return true;
 }
 
 bool
index 86a563a053ca002ffcce46c9638120314f7429b0..0182be17ce1b337b54268261866db6a6f1e787b1 100644 (file)
@@ -131,9 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  /* See target.h.  */
-  int (*supports_hardware_single_step) (void);
-
   /* Fill *SYSNO with the syscall nr trapped.  Only to be called when
      inferior is stopped due to SYSCALL_SIGTRAP.  */
   void (*get_syscall_trapinfo) (struct regcache *regcache, int *sysno);
@@ -401,6 +398,12 @@ private:
      events.  */
   void complete_ongoing_step_over ();
 
+  /* Finish a step-over.  Reinsert the breakpoint we had uninserted in
+     start_step_over, if still there, and delete any single-step
+     breakpoints we've set, on non hardware single-step targets.
+     Return true if step over finished.  */
+  bool finish_step_over (lwp_info *lwp);
+
   /* When we finish a step-over, set threads running again.  If there's
      another thread that may need a step-over, now's the time to start
      it.  Eventually, we'll move all threads past their breakpoints.  */
@@ -519,6 +522,9 @@ private:
      or can't single step.  */
   int single_step (lwp_info* lwp);
 
+  /* Return true if THREAD is doing hardware single step.  */
+  bool maybe_hw_step (thread_info *thread);
+
   /* Install breakpoints for software single stepping.  */
   void install_software_single_step_breakpoints (lwp_info *lwp);
 
index 8104e54c10d8acb9c4c13c0674b3f580f5d53a82..6d33157dfdf4cae30360a38e7a1a63a21754ad51 100644 (file)
@@ -134,14 +134,6 @@ m32r_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_m32r;
 }
 
-/* Support for hardware single step.  */
-
-static int
-m32r_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct usrregs_info m32r_usrregs_info =
   {
     m32r_num_regs,
@@ -161,7 +153,6 @@ m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  m32r_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index ccad368ea066de23865f35321e3a1975a8dc1c04..a5e39ffdb6279a3099ea8ecef143d6bc4f3762af 100644 (file)
@@ -256,16 +256,7 @@ m68k_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_m68k;
 }
 
-/* Support for hardware single step.  */
-
-static int
-m68k_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 struct linux_target_ops the_low_target = {
-  m68k_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index 4993125db99ed3ed094676ea720c5a6c0826b4fc..5c6930751e19ee12d5406f7ddb4616625c91d128 100644 (file)
@@ -805,14 +805,6 @@ ppc_store_evrregset (struct regcache *regcache, const void *buf)
   supply_register_by_name (regcache, "spefscr", &regset->spefscr);
 }
 
-/* Support for hardware single step.  */
-
-static int
-ppc_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct regset_info ppc_regsets[] = {
   /* List the extra register sets before GENERAL_REGS.  That way we will
      fetch them every time, but still fall back to PTRACE_PEEKUSER for the
@@ -3454,7 +3446,6 @@ ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  ppc_supports_hardware_single_step,
   NULL, /* get_syscall_trapinfo */
   ppc_get_ipa_tdesc_idx,
 };
index b5d5e898c0d8ec45cac1dfe75016b6f9d1d419d3..3ab14d884ee6ca745663c900aa98166db7d367c2 100644 (file)
@@ -723,14 +723,6 @@ s390_target::supports_z_point_type (char z_type)
     }
 }
 
-/* Support for hardware single step.  */
-
-static int
-s390_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct usrregs_info s390_usrregs_info =
   {
     s390_num_regs,
@@ -2863,7 +2855,6 @@ s390_target::emit_ops ()
 }
 
 struct linux_target_ops the_low_target = {
-  s390_supports_hardware_single_step,
   NULL, /* get_syscall_trapinfo */
   s390_get_ipa_tdesc_idx,
 };
index db40322cd43fceb0dd987dfd72c59a444d79b34f..3d961647b3a23be10e113cb6e82b604b03896403 100644 (file)
@@ -134,14 +134,6 @@ sh_target::low_breakpoint_at (CORE_ADDR where)
   return false;
 }
 
-/* Support for hardware single step.  */
-
-static int
-sh_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 /* Provide only a fill function for the general register set.  ps_lgetregs
    will use this for NPTL support.  */
 
@@ -192,7 +184,6 @@ sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  sh_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index c80a2fb20ed82ed31e46ac997af9e515e16e6f74..adcc410100e9fddca8eae4f424007a56c692d2bd 100644 (file)
@@ -394,14 +394,6 @@ tic6x_target::low_arch_setup ()
   current_process ()->tdesc = tic6x_read_description (feature);
 }
 
-/* Support for hardware single step.  */
-
-static int
-tic6x_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static struct regsets_info tic6x_regsets_info =
   {
     tic6x_regsets, /* regsets */
@@ -423,7 +415,6 @@ tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  tic6x_supports_hardware_single_step,
 };
 
 #if GDB_SELF_TEST
index 10af23fa48bb2adc220740acecec7b1cc2436ef2..39c9694fc8736b33be563ded37bd701b349e5458 100644 (file)
@@ -213,18 +213,8 @@ tile_target::low_arch_setup ()
     current_process ()->tdesc = tdesc_tilegx;
 }
 
-/* Support for hardware single step.  */
-
-static int
-tile_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
-
 struct linux_target_ops the_low_target =
 {
-  tile_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
index dce9a5fb7d7e0d3cd61e14baa1ac14ca8e03bd21..c05928d155606be68e5f7f7643b50770433fafb4 100644 (file)
@@ -2964,15 +2964,6 @@ x86_target::low_supports_range_stepping ()
   return true;
 }
 
-/* Implementation of linux_target_ops method "supports_hardware_single_step".
- */
-
-static int
-x86_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 static int
 x86_get_ipa_tdesc_idx (void)
 {
@@ -2994,7 +2985,6 @@ x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_supports_hardware_single_step,
   x86_get_syscall_trapinfo,
   x86_get_ipa_tdesc_idx,
 };
index e273666e1cfdb5b9188d3656d2c289a357b60ed2..9c41c24cde16094cba185208ba2167def5c50c4f 100644 (file)
@@ -314,14 +314,6 @@ xtensa_target::low_arch_setup ()
   current_process ()->tdesc = tdesc_xtensa;
 }
 
-/* Support for hardware single step.  */
-
-static int
-xtensa_supports_hardware_single_step (void)
-{
-  return 1;
-}
-
 const regs_info *
 xtensa_target::get_regs_info ()
 {
@@ -329,7 +321,6 @@ xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  xtensa_supports_hardware_single_step,
 };
 
 /* The linux target ops object.  */
This page took 0.040354 seconds and 4 git commands to generate.