]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-10-06 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Mon, 6 Oct 2008 23:52:33 +0000 (23:52 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 6 Oct 2008 23:52:33 +0000 (23:52 +0000)
* infcmd.c: Minor function reordering.

gdb/ChangeLog
gdb/infcmd.c

index 91dbce8228f0a3d46e2900bd125ee3f9d875603c..f49e421702d4baaf70ea9e49dd85bc2140875b96 100644 (file)
@@ -1,5 +1,6 @@
 2008-10-06  Michael Snyder  <msnyder@vmware.com>
 
+       * infcmd.c: Minor function reordering.
        * infrun.c (step_into_function): Rename to stepped_into_function.
        Split into two versions (normal (forward), and reverse).
        (handle_inferior_event): Call stepped_into_function or
index 0d982c96840a5a1e0a4024087da144d982fcf2c0..47c91e960346283f0fd57cdb79ee8fff6f192213 100644 (file)
@@ -1415,11 +1415,70 @@ finish_command_continuation_free_arg (void *arg)
   xfree (arg);
 }
 
+/* finish_backward -- helper function for finish_command.  */
+
+static void
+finish_backward (struct symbol *function)
+{
+  struct symtab_and_line sal;
+  struct breakpoint *breakpoint;
+  struct cleanup *old_chain;
+  CORE_ADDR func_addr;
+  int back_up;
+
+  if (find_pc_partial_function (get_frame_pc (get_current_frame ()),
+                               NULL, &func_addr, NULL) == 0)
+    internal_error (__FILE__, __LINE__,
+                   "Finish: couldn't find function.");
+
+  sal = find_pc_line (func_addr, 0);
+
+  /* Let's cheat and not worry about async until later.  */
+
+  /* We don't need a return value.  */
+  proceed_to_finish = 0;
+  /* Special case: if we're sitting at the function entry point,
+     then all we need to do is take a reverse singlestep.  We
+     don't need to set a breakpoint, and indeed it would do us
+     no good to do so.
+
+     Note that this can only happen at frame #0, since there's
+     no way that a function up the stack can have a return address
+     that's equal to its entry point.  */
+
+  if (sal.pc != read_pc ())
+    {
+      /* Set breakpoint and continue.  */
+      breakpoint =
+       set_momentary_breakpoint (sal,
+                                 get_frame_id (get_selected_frame (NULL)),
+                                 bp_breakpoint);
+      /* Tell the breakpoint to keep quiet.  We won't be done
+         until we've done another reverse single-step.  */
+      breakpoint_silence (breakpoint);
+      old_chain = make_cleanup_delete_breakpoint (breakpoint);
+      proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
+      /* We will be stopped when proceed returns.  */
+      back_up = bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL;
+      do_cleanups (old_chain);
+    }
+  else
+    back_up = 1;
+  if (back_up)
+    {
+      /* 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...) */
+      step_range_start = step_range_end = 1;
+      proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
+    }
+  return;
+}
+
 /* "finish": Set a temporary breakpoint at the place the selected
    frame will return to, then continue.  */
 
-static void finish_backwards (struct symbol *);
-
 static void
 finish_command (char *arg, int from_tty)
 {
@@ -1479,7 +1538,7 @@ finish_command (char *arg, int from_tty)
   if (target_get_execution_direction () == EXEC_REVERSE)
     {
       /* Split off at this point.  */
-      finish_backwards (function);
+      finish_backward (function);
       return;
     }
 
@@ -1556,65 +1615,6 @@ Type \"info stack\" or \"info registers\" for more information.\n"));
     }
 }
 
-static void
-finish_backwards (struct symbol *function)
-{
-  struct symtab_and_line sal;
-  struct breakpoint *breakpoint;
-  struct cleanup *old_chain;
-  CORE_ADDR func_addr;
-  int back_up;
-
-  if (find_pc_partial_function (get_frame_pc (get_current_frame ()),
-                               NULL, &func_addr, NULL) == 0)
-    internal_error (__FILE__, __LINE__,
-                   "Finish: couldn't find function.");
-
-  sal = find_pc_line (func_addr, 0);
-
-  /* Let's cheat and not worry about async until later.  */
-
-  /* We don't need a return value.  */
-  proceed_to_finish = 0;
-  /* Special case: if we're sitting at the function entry point,
-     then all we need to do is take a reverse singlestep.  We
-     don't need to set a breakpoint, and indeed it would do us
-     no good to do so.
-
-     Note that this can only happen at frame #0, since there's
-     no way that a function up the stack can have a return address
-     that's equal to its entry point.  */
-
-  if (sal.pc != read_pc ())
-    {
-      /* Set breakpoint and continue.  */
-      breakpoint =
-       set_momentary_breakpoint (sal,
-                                 get_frame_id (get_selected_frame (NULL)),
-                                 bp_breakpoint);
-      /* Tell the breakpoint to keep quiet.  We won't be done
-         until we've done another reverse single-step.  */
-      breakpoint_silence (breakpoint);
-      old_chain = make_cleanup_delete_breakpoint (breakpoint);
-      proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
-      /* We will be stopped when proceed returns.  */
-      back_up = bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL;
-      do_cleanups (old_chain);
-    }
-  else
-    back_up = 1;
-  if (back_up)
-    {
-      /* 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...) */
-      step_range_start = step_range_end = 1;
-      proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
-    }
-  return;
-}
-
 \f
 static void
 environment_info (char *var, int from_tty)