28bf096c62
Refs: https://sourceware.org/ml/gdb/2015-03/msg00024.html https://sourceware.org/ml/gdb/2015-06/msg00005.html On GNU/Linux, if an infcall spawns a thread, that thread ends up with stuck running state. This happens because: - when linux-nat.c detects a new thread, it marks them as running, and does not report anything to the core. - we skip finish_thread_state when the thread that is running the infcall stops. As result, that new thread ends up with stuck "running" state, even though it really is stopped. On Windows, _all_ threads end up stuck in running state, not just the one that was spawned. That happens because when a new thread is detected, unlike linux-nat.c, windows-nat.c reports TARGET_WAITKIND_SPURIOUS to infrun. It's the fact that that event does not cause a user-visible stop that triggers the problem. When the target is re-resumed, we call set_running with a wildcard ptid, which marks all thread as running. That set_running is not suppressed because the (leader) thread being resumed does not have in_infcall set. Later, when the infcall finally finishes successfully, nothing marks all threads back to stopped. We can trigger the same problem on all targets by having a thread other than the one that is running the infcall report a breakpoint hit to infrun, and then have that breakpoint not cause a stop. That's what the included test does. The fix is to stop GDB from suppressing the set_running calls while doing an infcall, and then set the threads back to stopped when the call finishes, iff they were originally stopped before the infcall started. (Note the MI *running/*stopped event suppression isn't affected.) Tested on x86_64 GNU/Linux. gdb/ChangeLog: 2015-06-29 Pedro Alves <palves@redhat.com> PR threads/18127 * infcall.c (run_inferior_call): On infcall success, if the thread was marked stopped before, reset it back to stopped. * infrun.c (resume): Don't suppress the set_running calls when doing an infcall. (normal_stop): Only discard the finish_thread_state cleanup if the infcall succeeded. gdb/testsuite/ChangeLog: 2015-06-29 Pedro Alves <palves@redhat.com> PR threads/18127 * gdb.threads/hand-call-new-thread.c: New file. * gdb.threads/hand-call-new-thread.c: New file. |
||
---|---|---|
.. | ||
attach-into-signal.c | ||
attach-into-signal.exp | ||
attach-many-short-lived-threads.c | ||
attach-many-short-lived-threads.exp | ||
attach-stopped.c | ||
attach-stopped.exp | ||
bp_in_thread.c | ||
bp_in_thread.exp | ||
break-while-running.c | ||
break-while-running.exp | ||
clone-new-thread-event.c | ||
clone-new-thread-event.exp | ||
clone-thread_db.c | ||
clone-thread_db.exp | ||
continue-pending-after-query.c | ||
continue-pending-after-query.exp | ||
continue-pending-status.c | ||
continue-pending-status.exp | ||
corethreads.c | ||
corethreads.exp | ||
create-fail.c | ||
create-fail.exp | ||
current-lwp-dead.c | ||
current-lwp-dead.exp | ||
dlopen-libpthread-lib.c | ||
dlopen-libpthread.c | ||
dlopen-libpthread.exp | ||
execl.c | ||
execl.exp | ||
execl1.c | ||
fork-child-threads.c | ||
fork-child-threads.exp | ||
fork-thread-pending.c | ||
fork-thread-pending.exp | ||
gcore-stale-thread.c | ||
gcore-stale-thread.exp | ||
gcore-thread.exp | ||
hand-call-in-threads.c | ||
hand-call-in-threads.exp | ||
hand-call-new-thread.c | ||
hand-call-new-thread.exp | ||
ia64-sigill.c | ||
ia64-sigill.exp | ||
info-threads-cur-sal-2.c | ||
info-threads-cur-sal.c | ||
info-threads-cur-sal.exp | ||
interrupted-hand-call.c | ||
interrupted-hand-call.exp | ||
kill.c | ||
kill.exp | ||
killed.c | ||
killed.exp | ||
leader-exit.c | ||
leader-exit.exp | ||
linux-dp.c | ||
linux-dp.exp | ||
local-watch-wrong-thread.c | ||
local-watch-wrong-thread.exp | ||
Makefile.in | ||
manythreads.c | ||
manythreads.exp | ||
multi-create-ns-info-thr.exp | ||
multi-create.c | ||
multi-create.exp | ||
multiple-step-overs.c | ||
multiple-step-overs.exp | ||
next-bp-other-thread.c | ||
next-bp-other-thread.exp | ||
no-unwaited-for-left.c | ||
no-unwaited-for-left.exp | ||
non-ldr-exc-1.c | ||
non-ldr-exc-1.exp | ||
non-ldr-exc-2.c | ||
non-ldr-exc-2.exp | ||
non-ldr-exc-3.c | ||
non-ldr-exc-3.exp | ||
non-ldr-exc-4.c | ||
non-ldr-exc-4.exp | ||
non-stop-fair-events.c | ||
non-stop-fair-events.exp | ||
pending-step.c | ||
pending-step.exp | ||
print-threads.c | ||
print-threads.exp | ||
pthread_cond_wait.c | ||
pthread_cond_wait.exp | ||
pthreads.c | ||
pthreads.exp | ||
queue-signal.c | ||
queue-signal.exp | ||
reconnect-signal.c | ||
reconnect-signal.exp | ||
schedlock.c | ||
schedlock.exp | ||
siginfo-threads.c | ||
siginfo-threads.exp | ||
signal-command-handle-nopass.c | ||
signal-command-handle-nopass.exp | ||
signal-command-multiple-signals-pending.c | ||
signal-command-multiple-signals-pending.exp | ||
signal-delivered-right-thread.c | ||
signal-delivered-right-thread.exp | ||
signal-sigtrap.c | ||
signal-sigtrap.exp | ||
signal-while-stepping-over-bp-other-thread.c | ||
signal-while-stepping-over-bp-other-thread.exp | ||
sigstep-threads.c | ||
sigstep-threads.exp | ||
sigthread.c | ||
sigthread.exp | ||
staticthreads.c | ||
staticthreads.exp | ||
step-bg-decr-pc-switch-thread.c | ||
step-bg-decr-pc-switch-thread.exp | ||
step-over-lands-on-breakpoint.c | ||
step-over-lands-on-breakpoint.exp | ||
step-over-trips-on-watchpoint.c | ||
step-over-trips-on-watchpoint.exp | ||
stepi-random-signal.c | ||
stepi-random-signal.exp | ||
switch-threads.c | ||
switch-threads.exp | ||
thread-execl.c | ||
thread-execl.exp | ||
thread-find.exp | ||
thread-specific-bp.c | ||
thread-specific-bp.exp | ||
thread-specific.c | ||
thread-specific.exp | ||
thread-unwindonsignal.exp | ||
thread_check.c | ||
thread_check.exp | ||
thread_events.c | ||
thread_events.exp | ||
threadapply.c | ||
threadapply.exp | ||
threxit-hop-specific.c | ||
threxit-hop-specific.exp | ||
tid-reuse.c | ||
tid-reuse.exp | ||
tls-main.c | ||
tls-nodebug.c | ||
tls-nodebug.exp | ||
tls-shared.c | ||
tls-shared.exp | ||
tls-var-main.c | ||
tls-var.c | ||
tls-var.exp | ||
tls.c | ||
tls.exp | ||
tls2.c | ||
watchpoint-fork-child.c | ||
watchpoint-fork-mt.c | ||
watchpoint-fork-parent.c | ||
watchpoint-fork-st.c | ||
watchpoint-fork.exp | ||
watchpoint-fork.h | ||
watchthreads-reorder.c | ||
watchthreads-reorder.exp | ||
watchthreads.c | ||
watchthreads.exp | ||
watchthreads2.c | ||
watchthreads2.exp | ||
wp-replication.c | ||
wp-replication.exp |