From a115d33d18e42f9c9a46196b2c52606d6ffc9639 Mon Sep 17 00:00:00 2001 From: palves Date: Mon, 8 Sep 2008 21:55:16 +0000 Subject: [PATCH] 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. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/gdbthread.h | 8 ++++---- gdb/infcmd.c | 11 ++++------- gdb/inferior.h | 4 ---- gdb/infrun.c | 39 ++++++++++++++++++++------------------- gdb/thread.c | 8 ++------ 6 files changed, 53 insertions(+), 40 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9f924d1404..5d363ad4eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,28 @@ 2008-09-08 Pedro Alves + 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 + Remove the global step_multi in favour of a per-thread step_multi. diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 11581e9eb1..398b713e78 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -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); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index afe6d55270..a4c6c94a47 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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) { diff --git a/gdb/inferior.h b/gdb/inferior.h index e29ff4e1e7..fa3b25e39d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -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; diff --git a/gdb/infrun.c b/gdb/infrun.c index e0be5be9a6..fbbc17a161 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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; diff --git a/gdb/thread.c b/gdb/thread.c index a3d85f86e6..39b353eb03 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -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; } } -- 2.11.0