Remove the global stop_step in favour of a per-thread
authorPedro Alves <palves@redhat.com>
Mon, 8 Sep 2008 21:55:16 +0000 (21:55 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 8 Sep 2008 21:55:16 +0000 (21:55 +0000)
stop_step.

* inferior.h (stop_step): Delete.

* gdbthread.h (struct thread_info): Add comments to stop_step.
(save_infrun_state, load_infrun_state): Remove stop_step argument.
* thread.c (load_infrun_state, save_infrun_state): Remove
stop_step argument, and references to it.

* infrun.c (clear_proceed_status): Clear stop_step.
(fetch_inferior_event): Adjust.
(context_switch): Don't context-switch stop_step.
(handle_inferior_event): Adjust.
(normal_stop): Adjust.
(save_inferior_status, restore_inferior_status): Adjust.

* infcmd.c (stop_step): Delete.
(step_1, step_1_continuation, step_once, until_next_command):
Adjust.

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

index 9f924d1404917de74acb5545c58f9e3d45a51e14..5d363ad4ebc737a28f56e603981cbb1860f73fbf 100644 (file)
@@ -1,3 +1,26 @@
+2008-09-08  Pedro Alves  <pedro@codesourcery.com>
+
+       Remove the global stop_step in favour of a per-thread
+       stop_step.
+
+       * inferior.h (stop_step): Delete.
+
+       * gdbthread.h (struct thread_info): Add comments to stop_step.
+       (save_infrun_state, load_infrun_state): Remove stop_step argument.
+       * thread.c (load_infrun_state, save_infrun_state): Remove
+       stop_step argument, and references to it.
+
+       * infrun.c (clear_proceed_status): Clear stop_step.
+       (fetch_inferior_event): Adjust.
+       (context_switch): Don't context-switch stop_step.
+       (handle_inferior_event): Adjust.
+       (normal_stop): Adjust.
+       (save_inferior_status, restore_inferior_status): Adjust.
+
+       * infcmd.c (stop_step): Delete.
+       (step_1, step_1_continuation, step_once, until_next_command):
+       Adjust.
+
 2008-09-08  Pedro Alves  <pedro@codesourcery.com>
 
        Remove the global step_multi in favour of a per-thread
index 11581e9eb134dd2705fa57c3adf86306e5613cd3..398b713e7807a9598c17cfe32c27a8249af904b0 100644 (file)
@@ -146,6 +146,8 @@ struct thread_info
   int proceed_to_finish;
 
   enum step_over_calls_kind step_over_calls;
+
+  /* Nonzero if stopped due to a step command.  */
   int stop_step;
 
   /* If stepping, nonzero means step count is > 1 so don't print frame
@@ -226,15 +228,13 @@ extern int thread_count (void);
 /* infrun context switch: save the debugger state for the given thread.  */
 extern void save_infrun_state (ptid_t ptid,
                               struct continuation *continuations,
-                              struct continuation *intermediate_continuations,
-                              int stop_step);
+                              struct continuation *intermediate_continuations);
 
 /* infrun context switch: load the debugger state previously saved
    for the given thread.  */
 extern void load_infrun_state (ptid_t ptid,
                               struct continuation **continuations,
-                              struct continuation **intermediate_continuations,
-                              int *stop_step);
+                              struct continuation **intermediate_continuations);
 
 /* Switch from one thread to another.  */
 extern void switch_to_thread (ptid_t ptid);
index afe6d5527015b53da35f9c1e6360522da9245a7d..a4c6c94a47cc1bcd24cb900b8406974f67786c2f 100644 (file)
@@ -156,10 +156,6 @@ CORE_ADDR stop_pc;
 
 int breakpoint_proceeded;
 
-/* Nonzero if stopped due to a step command.  */
-
-int stop_step;
-
 /* Nonzero if stopped due to completion of a stack dummy routine.  */
 
 int stop_stack_dummy;
@@ -826,7 +822,8 @@ which has no line number information.\n"), name);
          tp->step_multi = (count > 1);
          proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
 
-         if (!stop_step)
+         if (!target_has_execution
+             || !inferior_thread ()->stop_step)
            break;
        }
 
@@ -869,7 +866,7 @@ step_1_continuation (void *args)
       struct thread_info *tp;
 
       tp = inferior_thread ();
-      if (tp->step_multi && stop_step)
+      if (tp->step_multi && tp->stop_step)
        {
          /* There are more steps to make, and we did stop due to
             ending a stepping range.  Do another step.  */
@@ -1486,7 +1483,7 @@ program_info (char *args, int from_tty)
   target_files_info ();
   printf_filtered (_("Program stopped at %s.\n"),
                   hex_string ((unsigned long) stop_pc));
-  if (stop_step)
+  if (tp->stop_step)
     printf_filtered (_("It stopped after being stepped.\n"));
   else if (stat != 0)
     {
index e29ff4e1e70a7744c0c0966ffd01dcc2d2a31353..fa3b25e39dc86680c582bd391e038440353b4a6b 100644 (file)
@@ -288,10 +288,6 @@ extern CORE_ADDR stop_pc;
 
 extern int breakpoint_proceeded;
 
-/* Nonzero if stopped due to a step command.  */
-
-extern int stop_step;
-
 /* Nonzero if stopped due to completion of a stack dummy routine.  */
 
 extern int stop_stack_dummy;
index e0be5be9a62d7ac695a42e9de0f61f1af8604673..fbbc17a161649c5ca478185d7d17173a4df19506 100644 (file)
@@ -1105,6 +1105,8 @@ clear_proceed_status (void)
       tp->step_frame_id = null_frame_id;
       tp->step_over_calls = STEP_OVER_UNDEBUGGABLE;
 
+      tp->stop_step = 0;
+
       tp->proceed_to_finish = 0;
 
       /* Discard any remaining commands or status from previous
@@ -1659,7 +1661,7 @@ fetch_inferior_event (void *client_data)
          && ecs->ws.kind != TARGET_WAITKIND_EXITED
          && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
          && ecs->event_thread->step_multi
-         && stop_step)
+         && ecs->event_thread->stop_step)
        inferior_event_handler (INF_EXEC_CONTINUE, NULL);
       else
        inferior_event_handler (INF_EXEC_COMPLETE, NULL);
@@ -1741,13 +1743,11 @@ context_switch (ptid_t ptid)
     {                          /* Perform infrun state context switch: */
       /* Save infrun state for the old thread.  */
       save_infrun_state (inferior_ptid,
-                        cmd_continuation, intermediate_continuation,
-                        stop_step);
+                        cmd_continuation, intermediate_continuation);
 
       /* Load infrun state for the new thread.  */
       load_infrun_state (ptid,
-                        &cmd_continuation, &intermediate_continuation,
-                        &stop_step);
+                        &cmd_continuation, &intermediate_continuation);
     }
 
   switch_to_thread (ptid);
@@ -2524,7 +2524,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
     += gdbarch_deprecated_function_start_offset (current_gdbarch);
   ecs->event_thread->stepping_over_breakpoint = 0;
   bpstat_clear (&ecs->event_thread->stop_bpstat);
-  stop_step = 0;
+  ecs->event_thread->stop_step = 0;
   stop_print_frame = 1;
   ecs->random_signal = 0;
   stopped_by_random_signal = 0;
@@ -2834,7 +2834,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
        gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
        delete_step_resume_breakpoint (ecs->event_thread);
 
-       stop_step = 1;
+       ecs->event_thread->stop_step = 1;
        print_stop_reason (END_STEPPING_RANGE, 0);
        stop_stepping (ecs);
        return;
@@ -3131,7 +3131,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          /* Also, maybe we just did a "nexti" inside a prolog, so we
             thought it was a subroutine call but it was not.  Stop as
             well.  FENN */
-         stop_step = 1;
+         ecs->event_thread->stop_step = 1;
          print_stop_reason (END_STEPPING_RANGE, 0);
          stop_stepping (ecs);
          return;
@@ -3193,7 +3193,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
       if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
          && step_stop_if_no_debug)
        {
-         stop_step = 1;
+         ecs->event_thread->stop_step = 1;
          print_stop_reason (END_STEPPING_RANGE, 0);
          stop_stepping (ecs);
          return;
@@ -3267,7 +3267,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          /* If we have no line number and the step-stop-if-no-debug
             is set, we stop the step so that the user has a chance to
             switch in assembly mode.  */
-         stop_step = 1;
+         ecs->event_thread->stop_step = 1;
          print_stop_reason (END_STEPPING_RANGE, 0);
          stop_stepping (ecs);
          return;
@@ -3288,7 +3288,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          one instruction.  */
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n");
-      stop_step = 1;
+      ecs->event_thread->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       stop_stepping (ecs);
       return;
@@ -3302,7 +3302,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          or can this happen as a result of a return or longjmp?).  */
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: no line number info\n");
-      stop_step = 1;
+      ecs->event_thread->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       stop_stepping (ecs);
       return;
@@ -3318,7 +3318,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          better.  */
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different line\n");
-      stop_step = 1;
+      ecs->event_thread->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       stop_stepping (ecs);
       return;
@@ -3405,7 +3405,7 @@ step_into_function (struct execution_control_state *ecs)
   if (ecs->stop_func_start == stop_pc)
     {
       /* We are already there: stop now.  */
-      stop_step = 1;
+      ecs->event_thread->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       stop_stepping (ecs);
       return;
@@ -3665,7 +3665,8 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
       /* For now print nothing. */
       /* Print a message only if not in the middle of doing a "step n"
          operation for n > 1 */
-      if (!inferior_thread ()->step_multi || !stop_step)
+      if (!inferior_thread ()->step_multi
+         || !inferior_thread ()->stop_step)
        if (ui_out_is_mi_like_p (uiout))
          ui_out_field_string
            (uiout, "reason",
@@ -3818,7 +3819,7 @@ Further execution is probably impossible.\n"));
       && last.kind != TARGET_WAITKIND_SIGNALLED
       && last.kind != TARGET_WAITKIND_EXITED
       && inferior_thread ()->step_multi
-      && stop_step)
+      && inferior_thread ()->stop_step)
     goto done;
 
   target_terminal_ours ();
@@ -3889,7 +3890,7 @@ Further execution is probably impossible.\n"));
              /* FIXME: cagney/2002-12-01: Given that a frame ID does
                 (or should) carry around the function and does (or
                 should) use that when doing a frame comparison.  */
-             if (stop_step
+             if (tp->stop_step
                  && frame_id_eq (tp->step_frame_id,
                                  get_frame_id (get_current_frame ()))
                  && step_start_function == find_pc_function (stop_pc))
@@ -4411,7 +4412,7 @@ save_inferior_status (int restore_stack_info)
 
   inf_status->stop_signal = tp->stop_signal;
   inf_status->stop_pc = stop_pc;
-  inf_status->stop_step = stop_step;
+  inf_status->stop_step = tp->stop_step;
   inf_status->stop_stack_dummy = stop_stack_dummy;
   inf_status->stopped_by_random_signal = stopped_by_random_signal;
   inf_status->stepping_over_breakpoint = tp->trap_expected;
@@ -4465,7 +4466,7 @@ restore_inferior_status (struct inferior_status *inf_status)
 
   tp->stop_signal = inf_status->stop_signal;
   stop_pc = inf_status->stop_pc;
-  stop_step = inf_status->stop_step;
+  tp->stop_step = inf_status->stop_step;
   stop_stack_dummy = inf_status->stop_stack_dummy;
   stopped_by_random_signal = inf_status->stopped_by_random_signal;
   tp->trap_expected = inf_status->stepping_over_breakpoint;
index a3d85f86e69c933988cb1bb08f1adcd23e6dae63..39b353eb0370b39ab8f5ae29036e7b139d6dedae 100644 (file)
@@ -444,8 +444,7 @@ gdb_list_thread_ids (struct ui_out *uiout, char **error_message)
 void
 load_infrun_state (ptid_t ptid,
                   struct continuation **continuations,
-                  struct continuation **intermediate_continuations,
-                  int *stop_step)
+                  struct continuation **intermediate_continuations)
 {
   struct thread_info *tp;
 
@@ -463,7 +462,6 @@ load_infrun_state (ptid_t ptid,
       tp->continuations = NULL;
       *intermediate_continuations = tp->intermediate_continuations;
       tp->intermediate_continuations = NULL;
-      *stop_step = tp->stop_step;
     }
 }
 
@@ -472,8 +470,7 @@ load_infrun_state (ptid_t ptid,
 void
 save_infrun_state (ptid_t ptid,
                   struct continuation *continuations,
-                  struct continuation *intermediate_continuations,
-                  int stop_step)
+                  struct continuation *intermediate_continuations)
 {
   struct thread_info *tp;
 
@@ -489,7 +486,6 @@ save_infrun_state (ptid_t ptid,
     {
       tp->continuations = continuations;
       tp->intermediate_continuations = intermediate_continuations;
-      tp->stop_step = stop_step;
     }
 }