2008-07-31 Pedro Alves Clear proceed status of all threads that are going to be resumed. * infrun.c (clear_proceed_status_thread_callback): New. (clear_proceed_status): Use it. (proceed): Clear the proceed status off all threads that are going to be resumed. --- gdb/infrun.c | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) Index: src/gdb/infrun.c =================================================================== --- src.orig/gdb/infrun.c 2008-08-14 04:05:15.000000000 +0100 +++ src/gdb/infrun.c 2008-08-14 04:05:17.000000000 +0100 @@ -1081,6 +1081,29 @@ a command like `return' or `jump' to con /* Proceeding. */ +static int +clear_proceed_status_thread_callback (struct thread_info *tp, void *data) +{ + struct thread_info *ignore = data; + + if (ignore == tp) + return 0; + + if (is_exited (tp->ptid)) + return 0; + + tp->step_range_start = 0; + 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); + + return 0; +} + /* Clear out all variables saying what to do when inferior is continued. First do this, then set the ones you want, then call `proceed'. */ @@ -1091,19 +1114,10 @@ clear_proceed_status (void) { struct thread_info *tp = inferior_thread (); - tp->trap_expected = 0; - tp->step_range_start = 0; - tp->step_range_end = 0; - tp->step_frame_id = null_frame_id; - tp->step_over_calls = STEP_OVER_UNDEBUGGABLE; + clear_proceed_status_thread_callback (tp, NULL); + tp->trap_expected = 0; tp->stop_step = 0; - - tp->proceed_to_finish = 0; - - /* Discard any remaining commands or status from previous - stop. */ - bpstat_clear (&tp->stop_bpstat); } stop_after_trap = 0; @@ -1267,6 +1281,19 @@ proceed (CORE_ADDR addr, enum target_sig inferior. */ gdb_flush (gdb_stdout); + if (!non_stop + && (scheduler_mode == schedlock_off + || (scheduler_mode == schedlock_step && !step))) + { + /* We're going to let all threads run. Clear the user stepping + state of all other threads but the selected thread. The + selected thread is already taken care of and may be starting + a step request, so leave it be. */ + + iterate_over_threads (clear_proceed_status_thread_callback, + inferior_thread ()); + } + /* Refresh prev_pc value just prior to resuming. This used to be done in stop_stepping, however, setting prev_pc there did not handle scenarios such as inferior function calls or returning from