+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Remove the 'supports_software_single_step' linux target op and let
+ the concrete linux target define it by overriding the op in
+ process_stratum_target.
+ Turn the 'get_next_pcs' linux target op into a method of
+ linux_process_target.
+
+ * linux-low.h (struct linux_target_ops): Remove the ops.
+ (class linux_process_target) <supports_software_single_step>:
+ Remove.
+ <low_get_next_pcs>: Declare.
+ * linux-low.cc (can_software_single_step): Remove.
+ (linux_process_target::low_get_next_pcs): Define.
+ (linux_process_target::supports_software_single_step): Remove.
+
+ Update the callers below.
+
+ (linux_process_target::handle_extended_wait)
+ (linux_process_target::wait_1)
+ (linux_process_target::install_software_single_step_breakpoints)
+ (linux_process_target::single_step)
+ (linux_process_target::thread_needs_step_over)
+ (linux_process_target::proceed_one_lwp)
+ (linux_process_target::supports_range_stepping)
+
+ * linux-x86-low.cc (the_low_target): Remove the op field.
+ * linux-aarch64-low.cc (the_low_target): Ditto.
+ * linux-bfin-low.cc (the_low_target): Ditto.
+ * linux-cris-low.cc (the_low_target): Ditto.
+ * linux-crisv32-low.cc (the_low_target): Ditto.
+ * linux-m32r-low.cc (the_low_target): Ditto.
+ * linux-m68k-low.cc (the_low_target): Ditto.
+ * linux-mips-low.cc (the_low_target): Ditto.
+ * linux-nios2-low.cc (the_low_target): Ditto.
+ * linux-ppc-low.cc (the_low_target): Ditto.
+ * linux-riscv-low.cc (the_low_target): Ditto.
+ * linux-s390-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.
+ * linux-arm-low.cc (class arm_target) <low_get_next_pcs>
+ <supports_software_single_step>: Declare.
+ (arm_target::supports_software_single_step): Define.
+ (arm_gdbserver_get_next_pcs): Turn into...
+ (arm_target::low_get_next_pcs): ...this.
+ (the_low_target): Remove the op field.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'sw_breakpoint_from_kind' linux target op, and let
struct linux_target_ops the_low_target =
{
- NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
aarch64_breakpoint_at,
aarch64_supports_z_point_type,
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+ bool supports_software_single_step () override;
+
protected:
void low_arch_setup () override;
CORE_ADDR low_get_pc (regcache *regcache) override;
void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
+
+ std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache) override;
};
/* The singleton target ops object. */
have_ptrace_getregset = 0;
}
+bool
+arm_target::supports_software_single_step ()
+{
+ return true;
+}
+
/* Fetch the next possible PCs after the current instruction executes. */
-static std::vector<CORE_ADDR>
-arm_gdbserver_get_next_pcs (struct regcache *regcache)
+std::vector<CORE_ADDR>
+arm_target::low_get_next_pcs (regcache *regcache)
{
struct arm_get_next_pcs next_pcs_ctx;
}
struct linux_target_ops the_low_target = {
- arm_gdbserver_get_next_pcs,
0,
arm_breakpoint_at,
arm_supports_z_point_type,
}
struct linux_target_ops the_low_target = {
- NULL, /* get_next_pcs */
2,
bfin_breakpoint_at,
NULL, /* supports_z_point_type */
}
struct linux_target_ops the_low_target = {
- NULL, /* get_next_pcs */
0,
cris_breakpoint_at,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* get_next_pcs */
0,
cris_breakpoint_at,
cris_supports_z_point_type,
return 0;
}
-/* True if the low target can software single-step. Such targets
- implement the GET_NEXT_PCS callback. */
-
-static int
-can_software_single_step (void)
-{
- return (the_low_target.get_next_pcs != NULL);
-}
-
bool
linux_process_target::low_supports_breakpoints ()
{
gdb_assert_not_reached ("linux target op low_set_pc is not implemented");
}
+std::vector<CORE_ADDR>
+linux_process_target::low_get_next_pcs (regcache *regcache)
+{
+ gdb_assert_not_reached ("linux target op low_get_next_pcs is not "
+ "implemented");
+}
+
/* Returns true if this target can support fast tracepoints. This
does not mean that the in-process agent has been loaded in the
inferior. */
child_proc->attached = parent_proc->attached;
if (event_lwp->bp_reinsert != 0
- && can_software_single_step ()
+ && supports_software_single_step ()
&& event == PTRACE_EVENT_VFORK)
{
/* If we leave single-step breakpoints there, child will
In case of vfork, we'll reinsert them back once vforked
child is done. */
if (event_lwp->bp_reinsert != 0
- && can_software_single_step ())
+ && supports_software_single_step ())
{
/* The child process is forked and stopped, so it is safe
to access its memory without stopping all other threads
{
event_lwp->waitstatus.kind = TARGET_WAITKIND_VFORK_DONE;
- if (event_lwp->bp_reinsert != 0 && can_software_single_step ())
+ if (event_lwp->bp_reinsert != 0 && supports_software_single_step ())
{
reinsert_single_step_breakpoints (event_thr);
/* Remove the single-step breakpoints if any. Note that
there isn't single-step breakpoint if we finished stepping
over. */
- if (can_software_single_step ()
+ if (supports_software_single_step ()
&& has_single_step_breakpoints (current_thread))
{
stop_all_lwps (0, event_child);
/* Alright, we're going to report a stop. */
/* Remove single-step breakpoints. */
- if (can_software_single_step ())
+ if (supports_software_single_step ())
{
/* Remove single-step breakpoints or not. It it is true, stop all
lwps, so that other threads won't hit the breakpoint in the
scoped_restore save_current_thread = make_scoped_restore (¤t_thread);
current_thread = thread;
- std::vector<CORE_ADDR> next_pcs = the_low_target.get_next_pcs (regcache);
+ std::vector<CORE_ADDR> next_pcs = low_get_next_pcs (regcache);
for (CORE_ADDR pc : next_pcs)
set_single_step_breakpoint (pc, current_ptid);
{
step = 1;
}
- else if (can_software_single_step ())
+ else if (supports_software_single_step ())
{
install_software_single_step_breakpoints (lwp);
step = 0;
/* On software single step target, resume the inferior with signal
rather than stepping over. */
- if (can_software_single_step ()
+ if (supports_software_single_step ()
&& lwp->pending_signals != NULL
&& lwp_signal_can_be_delivered (lwp))
{
/* If resume_step is requested by GDB, install single-step
breakpoints when the thread is about to be actually resumed if
the single-step breakpoints weren't removed. */
- if (can_software_single_step ()
+ if (supports_software_single_step ()
&& !has_single_step_breakpoints (thread))
install_software_single_step_breakpoints (lwp);
return can_hardware_single_step ();
}
-bool
-linux_process_target::supports_software_single_step ()
-{
- return can_software_single_step ();
-}
-
bool
linux_process_target::stopped_by_watchpoint ()
{
bool
linux_process_target::supports_range_stepping ()
{
- if (can_software_single_step ())
+ if (supports_software_single_step ())
return true;
if (*the_low_target.supports_range_stepping == NULL)
return false;
struct linux_target_ops
{
- /* Find the next possible PCs after the current instruction executes. */
- std::vector<CORE_ADDR> (*get_next_pcs) (struct regcache *regcache);
-
int decr_pc_after_break;
int (*breakpoint_at) (CORE_ADDR pc);
int *handle_len) override;
#endif
- bool supports_software_single_step () override;
-
bool supports_catch_syscall () override;
int get_ipa_tdesc_idx () override;
virtual CORE_ADDR low_get_pc (regcache *regcache);
virtual void low_set_pc (regcache *regcache, CORE_ADDR newpc);
+
+ /* Find the next possible PCs after the current instruction executes.
+ Targets that override this method should also override
+ 'supports_software_single_step' to return true. */
+ virtual std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache);
};
extern linux_process_target *the_linux_target;
}
struct linux_target_ops the_low_target = {
- NULL,
0,
m32r_breakpoint_at,
NULL, /* supports_z_point_type */
}
struct linux_target_ops the_low_target = {
- NULL,
2,
m68k_breakpoint_at,
NULL, /* supports_z_point_type */
}
struct linux_target_ops the_low_target = {
- NULL, /* get_next_pcs */
0,
mips_breakpoint_at,
mips_supports_z_point_type,
struct linux_target_ops the_low_target =
{
- NULL, /* get_next_pcs */
0,
nios2_breakpoint_at,
};
}
struct linux_target_ops the_low_target = {
- NULL,
0,
ppc_breakpoint_at,
ppc_supports_z_point_type,
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
riscv_breakpoint_at,
};
}
struct linux_target_ops the_low_target = {
- NULL,
s390_breakpoint_len,
s390_breakpoint_at,
s390_supports_z_point_type,
}
struct linux_target_ops the_low_target = {
- NULL,
0,
sh_breakpoint_at,
NULL, /* supports_z_point_type */
}
struct linux_target_ops the_low_target = {
- NULL, /* get_next_pcs */
0,
sparc_breakpoint_at,
NULL, /* supports_z_point_type */
}
struct linux_target_ops the_low_target = {
- NULL,
0,
tic6x_breakpoint_at,
NULL, /* supports_z_point_type */
struct linux_target_ops the_low_target =
{
- NULL,
0,
tile_breakpoint_at,
NULL, /* supports_z_point_type */
struct linux_target_ops the_low_target =
{
- NULL,
1,
x86_breakpoint_at,
x86_supports_z_point_type,
}
struct linux_target_ops the_low_target = {
- NULL,
0,
xtensa_breakpoint_at,
NULL, /* supports_z_point_type */