@@ -3158,17 +3158,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,
};
@@ -74,6 +74,8 @@ public:
bool supports_z_point_type (char z_type) override;
+ bool supports_hardware_single_step () override;
+
protected:
void low_arch_setup () override;
@@ -1032,10 +1034,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". */
@@ -1119,7 +1121,6 @@ arm_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- arm_supports_hardware_single_step,
arm_get_syscall_trapinfo,
};
@@ -138,14 +138,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,
@@ -165,7 +157,6 @@ bfin_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- bfin_supports_hardware_single_step,
};
/* The linux target ops object. */
@@ -428,14 +428,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 },
@@ -470,7 +462,6 @@ crisv32_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- cris_supports_hardware_single_step,
};
/* The linux target ops object. */
@@ -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);
@@ -286,17 +285,6 @@ linux_process_target::linux_process_target (int decr_pc_after_break)
/* Nop. */
}
-/* 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
@@ -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);
@@ -403,6 +400,12 @@ class linux_process_target : public process_stratum_target
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. */
@@ -521,6 +524,9 @@ class linux_process_target : public process_stratum_target
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);
@@ -136,14 +136,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,
@@ -163,7 +155,6 @@ m32r_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- m32r_supports_hardware_single_step,
};
/* The linux target ops object. */
@@ -250,16 +250,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. */
@@ -807,14 +807,6 @@ ppc_store_evrregset (struct regcache *regcache, const void *buf)
supply_register_by_name (regcache, "spefscr", ®set->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
@@ -3456,7 +3448,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,
};
@@ -717,14 +717,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,
@@ -2857,7 +2849,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,
};
@@ -136,14 +136,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. */
@@ -194,7 +186,6 @@ sh_target::low_arch_setup ()
}
struct linux_target_ops the_low_target = {
- sh_supports_hardware_single_step,
};
/* The linux target ops object. */
@@ -396,14 +396,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 */
@@ -425,7 +417,6 @@ tic6x_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- tic6x_supports_hardware_single_step,
};
#if GDB_SELF_TEST
@@ -215,18 +215,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. */
@@ -2957,15 +2957,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)
{
@@ -2987,7 +2978,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,
};
@@ -316,14 +316,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 ()
{
@@ -331,7 +323,6 @@ xtensa_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- xtensa_supports_hardware_single_step,
};
/* The linux target ops object. */