OSDN Git Service

* gdbthread.h (struct thread_info): Add comments around
authorPedro Alves <pedro@codesourcery.com>
Mon, 8 Sep 2008 21:48:52 +0000 (21:48 +0000)
committerPedro Alves <pedro@codesourcery.com>
Mon, 8 Sep 2008 21:48:52 +0000 (21:48 +0000)
proceed_to_finish.
(save_infrun_state, load_infrun_state): Remove proceed_to_finish
argument.
* thread.c (load_infrun_state, save_infrun_state): Delete
proceed_to_finish argument and references to it.

* infcall.c (call_function_by_hand): Adjust.
* infcmd.c (finish_command): Adjust.
* infrun.c (proceed_to_finish): Delete.
(clear_proceed_status): Adjust.
(context_switch): Don't context-switch proceed_to_finish.
(normal_stop, save_inferior_status, restore_inferior_status):
Adjust.

gdb/ChangeLog
gdb/gdbthread.h
gdb/infcall.c
gdb/infcmd.c
gdb/infrun.c
gdb/thread.c

index 1b767aa..c0f2597 100644 (file)
@@ -1,5 +1,22 @@
 2008-09-08  Pedro Alves  <pedro@codesourcery.com>
 
+       * gdbthread.h (struct thread_info): Add comments around
+       proceed_to_finish.
+       (save_infrun_state, load_infrun_state): Remove proceed_to_finish
+       argument.
+       * thread.c (load_infrun_state, save_infrun_state): Delete
+       proceed_to_finish argument and references to it.
+
+       * infcall.c (call_function_by_hand): Adjust.
+       * infcmd.c (finish_command): Adjust.
+       * infrun.c (proceed_to_finish): Delete.
+       (clear_proceed_status): Adjust.
+       (context_switch): Don't context-switch proceed_to_finish.
+       (normal_stop, save_inferior_status, restore_inferior_status):
+       Adjust.
+
+2008-09-08  Pedro Alves  <pedro@codesourcery.com>
+
        * inferior.h (stop_bpstat): Delete.
 
        * breakpoint.h (bpstat_do_actions): Remove bpstat* argument.
index 82f1258..ca74976 100644 (file)
@@ -140,7 +140,11 @@ struct thread_info
   /* Per-thread command support.  */
   struct continuation *continuations;
   struct continuation *intermediate_continuations;
+
+  /* Nonzero if the thread is being proceeded for a "finish" command
+     or a similar situation when stop_registers should be saved.  */
   int proceed_to_finish;
+
   enum step_over_calls_kind step_over_calls;
   int stop_step;
   int step_multi;
@@ -219,7 +223,6 @@ extern int thread_count (void);
 extern void save_infrun_state (ptid_t ptid,
                               struct continuation *continuations,
                               struct continuation *intermediate_continuations,
-                              int proceed_to_finish,
                               int stop_step,
                               int step_multi,
                               enum target_signal stop_signal);
@@ -229,7 +232,6 @@ extern void save_infrun_state (ptid_t ptid,
 extern void load_infrun_state (ptid_t ptid,
                               struct continuation **continuations,
                               struct continuation **intermediate_continuations,
-                              int *proceed_to_finish,
                               int *stop_step,
                               int *step_multi,
                               enum target_signal *stop_signal);
index ec8f732..a6371ea 100644 (file)
@@ -710,6 +710,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
     struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
     struct cleanup *old_cleanups2;
     int saved_async = 0;
+    struct thread_info *tp = inferior_thread ();
 
     /* If all error()s out of proceed ended up calling normal_stop
        (and perhaps they should; it already does in the special case
@@ -717,7 +718,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
     make_cleanup (breakpoint_auto_delete_contents, NULL);
 
     disable_watchpoints_before_interactive_call_start ();
-    proceed_to_finish = 1;     /* We want stop_registers, please... */
+    tp->proceed_to_finish = 1; /* We want stop_registers, please... */
 
     if (target_can_async_p ())
       saved_async = target_async_mask (0);
index e197467..a86f236 100644 (file)
@@ -1382,6 +1382,7 @@ finish_command (char *arg, int from_tty)
   struct breakpoint *breakpoint;
   struct cleanup *old_chain;
   struct finish_command_continuation_args *cargs;
+  struct thread_info *tp;
 
   int async_exec = 0;
 
@@ -1411,6 +1412,8 @@ finish_command (char *arg, int from_tty)
   if (frame == 0)
     error (_("\"finish\" not meaningful in the outermost frame."));
 
+  tp = inferior_thread ();
+
   clear_proceed_status ();
 
   sal = find_pc_line (get_frame_pc (frame), 0);
@@ -1432,7 +1435,7 @@ finish_command (char *arg, int from_tty)
       print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
     }
 
-  proceed_to_finish = 1;       /* We want stop_registers, please...  */
+  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);
index 560722f..4e28c22 100644 (file)
@@ -237,11 +237,6 @@ int stop_after_trap;
 
 enum stop_kind stop_soon;
 
-/* Nonzero if proceed is being used for a "finish" command or a similar
-   situation when stop_registers should be saved.  */
-
-int proceed_to_finish;
-
 /* Save register contents here when about to pop a stack dummy frame,
    if-and-only-if proceed_to_finish is set.
    Thus this contains the return value from the called function (assuming
@@ -1105,6 +1100,9 @@ clear_proceed_status (void)
       tp->step_range_end = 0;
       tp->step_frame_id = null_frame_id;
       tp->step_over_calls = STEP_OVER_UNDEBUGGABLE;
+
+      tp->proceed_to_finish = 0;
+
       /* Discard any remaining commands or status from previous
         stop.  */
       bpstat_clear (&tp->stop_bpstat);
@@ -1112,7 +1110,6 @@ clear_proceed_status (void)
 
   stop_after_trap = 0;
   stop_soon = NO_STOP_QUIETLY;
-  proceed_to_finish = 0;
   breakpoint_proceeded = 1;    /* We're about to proceed... */
 
   if (stop_registers)
@@ -1714,7 +1711,6 @@ context_switch (ptid_t ptid)
       /* Save infrun state for the old thread.  */
       save_infrun_state (inferior_ptid,
                         cmd_continuation, intermediate_continuation,
-                        proceed_to_finish,
                         stop_step,
                         step_multi,
                         stop_signal);
@@ -1722,7 +1718,6 @@ context_switch (ptid_t ptid)
       /* Load infrun state for the new thread.  */
       load_infrun_state (ptid,
                         &cmd_continuation, &intermediate_continuation,
-                        &proceed_to_finish,
                         &stop_step,
                         &step_multi,
                         &stop_signal);
@@ -3807,6 +3802,10 @@ Further execution is probably impossible.\n"));
       goto done;
     }
 
+  if (last.kind == TARGET_WAITKIND_SIGNALLED
+      || last.kind == TARGET_WAITKIND_EXITED)
+    goto done;
+
   /* Select innermost stack frame - i.e., current frame is frame 0,
      and current location is based on that.
      Don't do this on return from a stack dummy routine,
@@ -3904,7 +3903,7 @@ Further execution is probably impossible.\n"));
 
   /* Save the function value return registers, if we care.
      We might be about to restore their previous contents.  */
-  if (proceed_to_finish)
+  if (inferior_thread ()->proceed_to_finish)
     {
       /* This should not be necessary.  */
       if (stop_registers)
@@ -4387,7 +4386,7 @@ save_inferior_status (int restore_stack_info)
   tp->stop_bpstat = bpstat_copy (tp->stop_bpstat);
   inf_status->breakpoint_proceeded = breakpoint_proceeded;
   inf_status->restore_stack_info = restore_stack_info;
-  inf_status->proceed_to_finish = proceed_to_finish;
+  inf_status->proceed_to_finish = tp->proceed_to_finish;
 
   inf_status->registers = regcache_dup (get_current_regcache ());
 
@@ -4436,7 +4435,7 @@ restore_inferior_status (struct inferior_status *inf_status)
   bpstat_clear (&tp->stop_bpstat);
   tp->stop_bpstat = inf_status->stop_bpstat;
   breakpoint_proceeded = inf_status->breakpoint_proceeded;
-  proceed_to_finish = inf_status->proceed_to_finish;
+  tp->proceed_to_finish = inf_status->proceed_to_finish;
 
   /* The inferior can be gone if the user types "print exit(0)"
      (and perhaps other times).  */
index fdd7d66..9d9831c 100644 (file)
@@ -445,7 +445,6 @@ void
 load_infrun_state (ptid_t ptid,
                   struct continuation **continuations,
                   struct continuation **intermediate_continuations,
-                  int *proceed_to_finish,
                   int *stop_step,
                   int *step_multi,
                   enum target_signal *stop_signal)
@@ -466,7 +465,6 @@ load_infrun_state (ptid_t ptid,
       tp->continuations = NULL;
       *intermediate_continuations = tp->intermediate_continuations;
       tp->intermediate_continuations = NULL;
-      *proceed_to_finish = tp->proceed_to_finish;
       *stop_step = tp->stop_step;
       *step_multi = tp->step_multi;
       *stop_signal = tp->stop_signal;
@@ -479,7 +477,6 @@ void
 save_infrun_state (ptid_t ptid,
                   struct continuation *continuations,
                   struct continuation *intermediate_continuations,
-                  int proceed_to_finish,
                   int stop_step,
                   int step_multi,
                   enum target_signal stop_signal)
@@ -498,7 +495,6 @@ save_infrun_state (ptid_t ptid,
     {
       tp->continuations = continuations;
       tp->intermediate_continuations = intermediate_continuations;
-      tp->proceed_to_finish = proceed_to_finish;
       tp->stop_step = stop_step;
       tp->step_multi = step_multi;
       tp->stop_signal = stop_signal;