]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-10-09 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Thu, 9 Oct 2008 17:45:01 +0000 (17:45 +0000)
committerMichael Snyder <msnyder@vmware.com>
Thu, 9 Oct 2008 17:45:01 +0000 (17:45 +0000)
* infcmd.c (finish_forward): New function, abstracted from
finish_command.
(finish_command): Abstract out finish_forward for symmetry.
* infrun.c (use_displaced_stepping): Add comment.

gdb/ChangeLog
gdb/infcmd.c
gdb/infrun.c

index 035ffe8f6f2307f8582ef08681c061e65b2a0c31..7f1dae85c326d28f1ca86bba99ce43caf5700b95 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-09  Michael Snyder  <msnyder@vmware.com>
+
+       * infcmd.c (finish_forward): New function, abstracted from 
+       finish_command.
+       (finish_command): Abstract out finish_forward for symmetry.
+       * infrun.c (use_displaced_stepping): Add comment.
+
 2008-10-08  Hui Zhu  <teawater@gmail.com>
 
        * record.c (record_open): Reset after push_target.
index 131f4af82635ed4f0d889ea9923ba07616fb3d2b..e5f9a537b2b3a972eed3062a537e90b93baea825 100644 (file)
@@ -1370,9 +1370,10 @@ finish_command_continuation_free_arg (void *arg)
 /* finish_backward -- helper function for finish_command.  */
 
 static void
-finish_backward (struct symbol *function, struct thread_info *tp)
+finish_backward (struct symbol *function)
 {
   struct symtab_and_line sal;
+  struct thread_info *tp = inferior_thread ();
   struct breakpoint *breakpoint;
   struct cleanup *old_chain;
   CORE_ADDR func_addr;
@@ -1385,8 +1386,6 @@ finish_backward (struct symbol *function, struct thread_info *tp)
 
   sal = find_pc_line (func_addr, 0);
 
-  /* TODO: Let's not worry about async until later.  */
-
   /* We don't need a return value.  */
   tp->proceed_to_finish = 0;
   /* Special case: if we're sitting at the function entry point,
@@ -1421,26 +1420,56 @@ finish_backward (struct symbol *function, struct thread_info *tp)
       /* If in fact we hit the step-resume breakpoint (and not
         some other breakpoint), then we're almost there --
         we just need to back up by one more single-step.  */
-      /* (Kludgy way of letting wait_for_inferior know...) */
       tp->step_range_start = tp->step_range_end = 1;
       proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
     }
   return;
 }
 
+/* finish_forward -- helper function for finish_command.  */
+
+static void
+finish_forward (struct symbol *function, struct frame_info *frame)
+{
+  struct symtab_and_line sal;
+  struct thread_info *tp = inferior_thread ();
+  struct breakpoint *breakpoint;
+  struct cleanup *old_chain;
+  struct finish_command_continuation_args *cargs;
+
+  sal = find_pc_line (get_frame_pc (frame), 0);
+  sal.pc = get_frame_pc (frame);
+
+  breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame),
+                                         bp_finish);
+
+  old_chain = make_cleanup_delete_breakpoint (breakpoint);
+
+  tp->proceed_to_finish = 1;    /* We want stop_registers, please...  */
+  make_cleanup_restore_integer (&suppress_stop_observer);
+  suppress_stop_observer = 1;
+  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+
+  cargs = xmalloc (sizeof (*cargs));
+
+  cargs->breakpoint = breakpoint;
+  cargs->function = function;
+  add_continuation (tp, finish_command_continuation, cargs,
+                    finish_command_continuation_free_arg);
+
+  discard_cleanups (old_chain);
+  if (!target_can_async_p ())
+    do_all_continuations ();
+}
+
 /* "finish": Set a temporary breakpoint at the place the selected
    frame will return to, then continue.  */
 
 static void
 finish_command (char *arg, int from_tty)
 {
-  struct symtab_and_line sal;
   struct frame_info *frame;
   struct symbol *function;
-  struct breakpoint *breakpoint;
-  struct cleanup *old_chain;
-  struct finish_command_continuation_args *cargs;
-  struct thread_info *tp;
 
   int async_exec = 0;
 
@@ -1474,8 +1503,6 @@ finish_command (char *arg, int from_tty)
   if (frame == 0)
     error (_("\"finish\" not meaningful in the outermost frame."));
 
-  tp = inferior_thread ();
-
   clear_proceed_status ();
 
   /* Find the function we will return from.  */
@@ -1495,35 +1522,9 @@ finish_command (char *arg, int from_tty)
     }
 
   if (execution_direction == EXEC_REVERSE)
-    {
-      /* Split off at this point.  */
-      finish_backward (function, tp);
-      return;
-    }
-
-  sal = find_pc_line (get_frame_pc (frame), 0);
-  sal.pc = get_frame_pc (frame);
-
-  breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), 
-                                        bp_finish);
-
-  old_chain = make_cleanup_delete_breakpoint (breakpoint);
-
-  tp->proceed_to_finish = 1;   /* We want stop_registers, please...  */
-  make_cleanup_restore_integer (&suppress_stop_observer);
-  suppress_stop_observer = 1;
-  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
-
-  cargs = xmalloc (sizeof (*cargs));
-
-  cargs->breakpoint = breakpoint;
-  cargs->function = function;
-  add_continuation (tp, finish_command_continuation, cargs,
-                   finish_command_continuation_free_arg);
-
-  discard_cleanups (old_chain);
-  if (!target_can_async_p ())
-    do_all_continuations ();
+    finish_backward (function);
+  else
+    finish_forward (function, frame);
 }
 \f
 
index 1449b076ff294d7b4fdc79238e0d12defe34f0f3..4bac5ea5663c739c50481f038ae3a0238bc53ed0 100644 (file)
@@ -571,6 +571,7 @@ Debugger's willingness to use displaced stepping to step over "
 
 /* Return non-zero if displaced stepping is enabled, and can be used
    with GDBARCH.  */
+/* Disable when using the process record/replay target.  */
 static int
 use_displaced_stepping (struct gdbarch *gdbarch)
 {