1 # Copyright 2021-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 continuing over a thread spawn with scheduler-locking on.
20 foreach_with_prefix schedlock {off on} {
21 set sl [expr $schedlock == "on" ? 1 : 0]
22 if { [build_executable "failed to prepare" $testfile-$sl \
24 [list debug pthreads additional_flags=-DSCHEDLOCK=$sl]] \
30 proc test {non-stop schedlock} {
31 save_vars ::GDBFLAGS {
32 append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
33 set sl [expr $schedlock == "on" ? 1 : 0]
34 clean_restart $::binfile-$sl
37 set linenum1 [gdb_get_line_number "set break 1 here"]
39 if { ![runto $::srcfile:$linenum1] } {
45 set linenum2 [gdb_get_line_number "set break 2 here"]
46 gdb_breakpoint $linenum2
48 gdb_breakpoint "thread_func"
50 gdb_test_no_output "set scheduler-locking $schedlock"
54 "return 0.*set break 2 here .*" \
55 "continue does not stop in new thread"
59 "continue stops in new thread"
63 foreach_with_prefix non-stop {off on} {
64 foreach_with_prefix schedlock {off on} {
65 test ${non-stop} ${schedlock}