diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 209834a15fc4..9b3b64dcf93e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-02-03 Pedro Alves + + PR gdb/27055 + * infrun.c (handle_signal_stop): Move main context_switch call + earlier, before STOP_QUIETLY_NO_SIGSTOP. + 2021-02-02 Lancelot SIX * NEWS (Changed commands): Add entry for the behavior change of diff --git a/gdb/infrun.c b/gdb/infrun.c index e070eff33d7a..405b907856ae 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5735,13 +5735,16 @@ handle_signal_stop (struct execution_control_state *ecs) ecs->event_thread->suspend.stop_pc = regcache_read_pc (get_thread_regcache (ecs->event_thread)); + context_switch (ecs); + + if (deprecated_context_hook) + deprecated_context_hook (ecs->event_thread->global_num); + if (debug_infrun) { struct regcache *regcache = get_thread_regcache (ecs->event_thread); struct gdbarch *reg_gdbarch = regcache->arch (); - switch_to_thread (ecs->event_thread); - infrun_debug_printf ("stop_pc=%s", paddress (reg_gdbarch, ecs->event_thread->suspend.stop_pc)); @@ -5764,7 +5767,6 @@ handle_signal_stop (struct execution_control_state *ecs) stop_soon = get_inferior_stop_soon (ecs); if (stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_REMOTE) { - context_switch (ecs); infrun_debug_printf ("quietly stopped"); stop_print_frame = true; stop_waiting (ecs); @@ -5802,18 +5804,6 @@ handle_signal_stop (struct execution_control_state *ecs) return; } - /* See if something interesting happened to the non-current thread. If - so, then switch to that thread. */ - if (ecs->ptid != inferior_ptid) - { - infrun_debug_printf ("context switch"); - - context_switch (ecs); - - if (deprecated_context_hook) - deprecated_context_hook (ecs->event_thread->global_num); - } - /* At this point, get hold of the now-current thread's frame. */ frame = get_current_frame (); gdbarch = get_frame_arch (frame);