gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / infrun.c
index efb3a239275c4afd97346596e42aa55ce1383c86..159a13b3a238bb69c8fd45ac71d2185b40535e4a 100644 (file)
@@ -1586,15 +1586,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
@@ -1613,11 +1613,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.  */
@@ -1685,9 +1682,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.023374 seconds and 4 git commands to generate.