]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Don't resume new threads if scheduler-locking is in effect
authorPedro Alves <pedro@palves.net>
Tue, 30 Nov 2021 19:52:11 +0000 (19:52 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 12 Dec 2022 19:33:12 +0000 (19:33 +0000)
commit55144e87273ff61616c6c9c78d9b62e74d65b3e8
tree0938ab31e1aaff88e62ddeceb475f3ea4255f791
parent190583a1b6441e3541ecae2198640e9ae9a46eba
Don't resume new threads if scheduler-locking is in effect

If scheduler-locking is in effect, like e.g., with "set
scheduler-locking on", and you step over a function that spawns a new
thread, the new thread is allowed to run free, at least until some
event is hit, at which point, whether the new thread is re-resumed
depends on a number of seemingly random factors.  E.g., if the target
is all-stop, and the parent thread hits a breakpoint, and gdb decides
the breakpoint isn't interesting to report to the user, then the
parent thread is resumed, but the new thread is left stopped.

I think that letting the new threads run with scheduler-locking
enabled is a defect.  This commit fixes that, making use of the new
clone events on Linux, and of target_thread_events() on targets where
new threads have no connection to the thread that spawned them.

Testcase and documentation changes included.

Approved-By: Eli Zaretskii <eliz@gnu.org>
Change-Id: Ie12140138b37534b7fc1d904da34f0f174aa11ce
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/infrun.c
gdb/testsuite/gdb.threads/schedlock-new-thread.c [new file with mode: 0644]
gdb/testsuite/gdb.threads/schedlock-new-thread.exp [new file with mode: 0644]