step-N-all-progress.exp revision 1.1 1 # Copyright 2022-2023 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
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.
22
23 standard_testfile
24
25 if { [build_executable "failed to prepare" $testfile \
26 $srcfile {debug pthreads}] == -1 } {
27 return
28 }
29
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
35 }
36
37 if { ![runto_main] } {
38 return
39 }
40
41 set lineno [gdb_get_line_number "set break here"]
42
43 gdb_breakpoint $lineno
44
45 gdb_continue_to_breakpoint "break here"
46
47 gdb_test "next 3" "return 0;"
48 }
49
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.
54 continue
55 }
56
57 test ${non-stop} ${target-non-stop}
58 }
59 }
60