From: Pedro Alves Date: Mon, 8 Sep 2008 21:48:52 +0000 (+0000) Subject: * gdbthread.h (struct thread_info): Add comments around X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32400bebb23653900ef060aae37668a2a1961155;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1b767aacc34..c0f2597a6dd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2008-09-08 Pedro Alves + + * 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 * inferior.h (stop_bpstat): Delete. diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 82f12587df5..ca74976fb87 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -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); diff --git a/gdb/infcall.c b/gdb/infcall.c index ec8f732376e..a6371eacd84 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -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); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index e1974675dbc..a86f236cf5c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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); diff --git a/gdb/infrun.c b/gdb/infrun.c index 560722fd7f8..4e28c220c1e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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). */ diff --git a/gdb/thread.c b/gdb/thread.c index fdd7d66680e..9d9831c2f15 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -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;