gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / infrun.c
index 90d5b2717e39c8e1c2024b24760f214e8fdbe136..de09bb038359b26495bde1d654c97009cf3670cb 100644 (file)
@@ -1603,15 +1603,15 @@ show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
                        "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
@@ -1630,11 +1630,8 @@ use_displaced_stepping (thread_info *tp)
       && !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.  */
@@ -1702,9 +1699,9 @@ displaced_step_prepare_throw (thread_info *tp)
   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);
This page took 0.024151 seconds and 4 git commands to generate.