[PATCH 05/12] gdb: rename displaced_step_fixup to displaced_step_finish

Simon Marchi simon.marchi@efficios.com
Tue Nov 10 21:46:07 GMT 2020


This is a preparatory patch to reduce a little bit the diff size of the
main patch later in this series.  It renames the displaced_step_fixup
function in infrun.c to displaced_step_finish.

The rationale is to better differentiate the low and high level
operations.

We first have the low level operation of writing an instruction to a
displaced buffer, called "copy_insn".  The mirror low level operation to
fix up the state after having executed the instruction is "fixup".  The
high level operation of preparing a thread for a displaced step (which
includes doing the "copy_insn" and some more bookkeeping) is called
"prepare" (as in displaced_step_prepare).  The mirror high level
operation to cleaning up after a displaced step (which includes doing
the "fixup" and some more bookkeeping) is currently also called "fixup"
(as in displaced_step_fixup), just like the low level operation.

I think that choosing a different name for the low and high level
cleanup operation makes it clearer, hence "finish".

gdb/ChangeLog:

	* infrun.c (displaced_step_fixup): Rename to...
	(displaced_step_finish): ... this, update all callers.

Change-Id: Id32f48c1e2091d09854c77fcedcc14d2519957a2
---
 gdb/infrun.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 71e0ab1e4fb..cdf198bb307 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1457,7 +1457,7 @@ step_over_info_valid_p (void)
    place it in the displaced_step_request_queue.  Whenever a displaced
    step finishes, we pick the next thread in the queue and start a new
    displaced step operation on it.  See displaced_step_prepare and
-   displaced_step_fixup for details.  */
+   displaced_step_finish for details.  */
 
 /* Default destructor for displaced_step_copy_insn_closure.  */
 
@@ -1847,7 +1847,7 @@ displaced_step_restore (struct displaced_step_inferior_state *displaced,
    -1.  If the thread wasn't displaced stepping, return 0.  */
 
 static int
-displaced_step_fixup (thread_info *event_thread, enum gdb_signal signal)
+displaced_step_finish (thread_info *event_thread, enum gdb_signal signal)
 {
   struct displaced_step_inferior_state *displaced
     = get_displaced_stepping_state (event_thread->inf);
@@ -2208,7 +2208,7 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
 
      Likewise if we're displaced stepping, otherwise a trap for a
      breakpoint in a signal handler might be confused with the
-     displaced step finishing.  We don't make the displaced_step_fixup
+     displaced step finishing.  We don't make the displaced_step_finish
      step distinguish the cases instead, because:
 
      - a backtrace while stopped in the signal handler would show the
@@ -4822,7 +4822,7 @@ stop_all_threads (void)
 		      t->suspend.waitstatus.kind = TARGET_WAITKIND_IGNORE;
 		      t->suspend.waitstatus_pending_p = 0;
 
-		      if (displaced_step_fixup (t, GDB_SIGNAL_0) < 0)
+		      if (displaced_step_finish (t, GDB_SIGNAL_0) < 0)
 			{
 			  /* Add it back to the step-over queue.  */
 			  infrun_debug_printf
@@ -4850,7 +4850,7 @@ stop_all_threads (void)
 		      sig = (event.ws.kind == TARGET_WAITKIND_STOPPED
 			     ? event.ws.value.sig : GDB_SIGNAL_0);
 
-		      if (displaced_step_fixup (t, sig) < 0)
+		      if (displaced_step_finish (t, sig) < 0)
 			{
 			  /* Add it back to the step-over queue.  */
 			  t->control.trap_expected = 0;
@@ -5318,7 +5318,7 @@ handle_inferior_event (struct execution_control_state *ecs)
 	       has been done.  Perform cleanup for parent process here.  Note
 	       that this operation also cleans up the child process for vfork,
 	       because their pages are shared.  */
-	    displaced_step_fixup (ecs->event_thread, GDB_SIGNAL_TRAP);
+	    displaced_step_finish (ecs->event_thread, GDB_SIGNAL_TRAP);
 	    /* Start a new step-over in another thread if there's one
 	       that needs it.  */
 	    start_step_over ();
@@ -5661,8 +5661,8 @@ resumed_thread_with_pending_status (struct thread_info *tp,
 static int
 finish_step_over (struct execution_control_state *ecs)
 {
-  displaced_step_fixup (ecs->event_thread,
-			ecs->event_thread->suspend.stop_signal);
+  displaced_step_finish (ecs->event_thread,
+			 ecs->event_thread->suspend.stop_signal);
 
   bool had_step_over_info = step_over_info_valid_p ();
 
-- 
2.28.0



More information about the Gdb-patches mailing list