diff options
-rw-r--r-- | gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdbserver/linux-low.cc | 29 |
2 files changed, 33 insertions, 1 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 41154d9..3f94083 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,5 +1,10 @@ 2021-02-03 Pedro Alves <pedro@palves.net> + * linux-low.cc (linux_process_target::complete_ongoing_step_over): + Discard step SIGTRAP, unless GDB wanted the thread to step. + +2021-02-03 Pedro Alves <pedro@palves.net> + * server.cc (discard_queued_stop_replies): Don't ever discard the notification at the head of the list. diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index d167914..cc19581 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -4695,7 +4695,34 @@ linux_process_target::complete_ongoing_step_over () lwp = find_lwp_pid (step_over_bkpt); if (lwp != NULL) - finish_step_over (lwp); + { + finish_step_over (lwp); + + /* If we got our step SIGTRAP, don't leave it pending, + otherwise we would report it to GDB as a spurious + SIGTRAP. */ + gdb_assert (lwp->status_pending_p); + if (WIFSTOPPED (lwp->status_pending) + && WSTOPSIG (lwp->status_pending) == SIGTRAP) + { + thread_info *thread = get_lwp_thread (lwp); + if (thread->last_resume_kind != resume_step) + { + if (debug_threads) + debug_printf ("detach: discard step-over SIGTRAP\n"); + + lwp->status_pending_p = 0; + lwp->status_pending = 0; + resume_one_lwp (lwp, lwp->stepping, 0, NULL); + } + else + { + if (debug_threads) + debug_printf ("detach: resume_step, " + "not discarding step-over SIGTRAP\n"); + } + } + } step_over_bkpt = null_ptid; unsuspend_all_lwps (lwp); } |