return status;
}
+bool
+default_supports_displaced_step (target_ops *target, thread_info *thread)
+{
+ /* Only check for the presence of `prepare`. `finish` is required by the
+ gdbarch verification to be provided if `prepare` is. */
+ gdbarch *arch = thread->arch ();
+ return gdbarch_displaced_step_prepare_p (arch);
+}
+
displaced_step_prepare_status
- default_displaced_step_prepare (target_ops *target, thread_info *thread)
+default_displaced_step_prepare (target_ops *target, thread_info *thread)
{
gdbarch *arch = thread->arch ();
return gdbarch_displaced_step_prepare (arch, thread);
std::vector<displaced_step_buffer_state> m_buffers;
};
+bool default_supports_displaced_step (target_ops *target, thread_info *thread);
+
displaced_step_prepare_status
default_displaced_step_prepare (target_ops *target, thread_info *thread);
"to step over breakpoints is %s.\n"), value);
}
-/* Return true if the gdbarch implements the required methods to use
- displaced stepping. */
+/* Return true if the target behing THREAD supports displaced stepping. */
static bool
-gdbarch_supports_displaced_stepping (gdbarch *arch)
+target_supports_displaced_stepping (thread_info *thread)
{
- /* Only check for the presence of `prepare`. `finish` is required by the
- gdbarch verification to be provided if `prepare` is provided. */
- return gdbarch_displaced_step_prepare_p (arch);
+ inferior *inf = thread->inf;
+ target_ops *target = inf->top_target ();
+
+ return target->supports_displaced_step (thread);
}
/* Return non-zero if displaced stepping can/should be used to step
&& !target_is_non_stop_p ())
return false;
- gdbarch *gdbarch = get_thread_regcache (tp)->arch ();
-
- /* If the architecture doesn't implement displaced stepping, don't use
- it. */
- if (!gdbarch_supports_displaced_stepping (gdbarch))
+ /* If the target doesn't support displaced stepping, don't use it. */
+ if (!target_supports_displaced_stepping (tp))
return false;
/* If recording, don't use displaced stepping. */
displaced_step_thread_state *thread_disp_step_state
= get_displaced_stepping_state (tp);
- /* We should never reach this function if the architecture does not
+ /* We should never reach this function if the target does not
support displaced stepping. */
- gdb_assert (gdbarch_supports_displaced_stepping (gdbarch));
+ gdb_assert (target_supports_displaced_stepping (tp));
/* Nor if the thread isn't meant to step over a breakpoint. */
gdb_assert (tp->control.trap_expected);
const struct frame_unwind *get_tailcall_unwinder () override;
void prepare_to_generate_core () override;
void done_generating_core () override;
+ bool supports_displaced_step (thread_info *arg0) override;
displaced_step_prepare_status displaced_step_prepare (thread_info *arg0) override;
displaced_step_finish_status displaced_step_finish (thread_info *arg0, gdb_signal arg1) override;
};
const struct frame_unwind *get_tailcall_unwinder () override;
void prepare_to_generate_core () override;
void done_generating_core () override;
+ bool supports_displaced_step (thread_info *arg0) override;
displaced_step_prepare_status displaced_step_prepare (thread_info *arg0) override;
displaced_step_finish_status displaced_step_finish (thread_info *arg0, gdb_signal arg1) override;
};
fputs_unfiltered (")\n", gdb_stdlog);
}
+bool
+target_ops::supports_displaced_step (thread_info *arg0)
+{
+ return this->beneath ()->supports_displaced_step (arg0);
+}
+
+bool
+dummy_target::supports_displaced_step (thread_info *arg0)
+{
+ return default_supports_displaced_step (this, arg0);
+}
+
+bool
+debug_target::supports_displaced_step (thread_info *arg0)
+{
+ bool result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_displaced_step (...)\n", this->beneath ()->shortname ());
+ result = this->beneath ()->supports_displaced_step (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_displaced_step (", this->beneath ()->shortname ());
+ target_debug_print_thread_info_p (arg0);
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_bool (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
displaced_step_prepare_status
target_ops::displaced_step_prepare (thread_info *arg0)
{
virtual void done_generating_core ()
TARGET_DEFAULT_IGNORE ();
+ virtual bool supports_displaced_step (thread_info *thread)
+ TARGET_DEFAULT_FUNC (default_supports_displaced_step);
+
virtual displaced_step_prepare_status displaced_step_prepare (thread_info *thread)
TARGET_DEFAULT_FUNC (default_displaced_step_prepare);