1 # Copyright 2022-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Test that with "next N", all threads are resumed at each of the N
17 # steps. GDB used to have a bug where in target-non-stop targets, and
18 # in all-stop mode, after the first "next" (or "step/stepi/nexti"),
19 # GDB would prematurely stop all threads. For the subsequent N-1
20 # steps, only the stepped thread would continue running, while all the
21 # other threads would remain stopped.
25 if { [build_executable "failed to prepare" $testfile \
26 $srcfile {debug pthreads}] == -1 } {
30 proc test {non-stop target-non-stop} {
31 save_vars ::GDBFLAGS {
32 append ::GDBFLAGS " -ex \"maintenance set target-non-stop ${target-non-stop}\""
33 append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
34 clean_restart $::binfile
37 if { ![runto_main] } {
41 set lineno [gdb_get_line_number "set break here"]
43 gdb_breakpoint $lineno
45 gdb_continue_to_breakpoint "break here"
47 gdb_test -no-prompt-anchor "next 3" "return 0;"
50 foreach_with_prefix non-stop {off on} {
51 foreach_with_prefix target-non-stop {off on} {
52 if {${non-stop} == "on" && ${target-non-stop} == "off"} {
53 # Invalid combination.
57 test ${non-stop} ${target-non-stop}