]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / multiple-successive-infcall.exp
1 # Copyright (C) 2018-2024 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 # multiple-successive-infcall.exp -- Test if GDB can invoke functions on
17 # multiple inferiors, one after the other.
18
19 standard_testfile
20
21 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
22 executable {debug additional_flags=-std=gnu99}] != "" } {
23 return -1
24 }
25
26 clean_restart "${binfile}"
27
28 if {![runto_main]} {
29 return 0
30 }
31
32 # Ensure that each new thread is detected by GDB in the order that the
33 # test case creates them, so the thread identifiers match between
34 # test and test case.
35 gdb_breakpoint [gdb_get_line_number "prethreadcreationmarker"]
36 gdb_continue_to_breakpoint "prethreadcreationmarker"
37 set after_new_thread_message "created new thread"
38 foreach_with_prefix thread {5 4 3} {
39 gdb_test_multiple "continue" "${after_new_thread_message}" {
40 -re "\\\[New Thread ${hex} \\\(LWP \[0-9\]+\\\)\\\].*${gdb_prompt}" {
41 pass "${after_new_thread_message}"
42 }
43 -re -wrap "\\\[New Thread $decimal\\.$decimal\\\]\r\n.*" {
44 pass $gdb_test_name
45 }
46 }
47 }
48
49 gdb_breakpoint [gdb_get_line_number "testmarker01"]
50 gdb_continue_to_breakpoint "testmarker01"
51 gdb_test_no_output "set scheduler-locking on"
52 gdb_test "show scheduler-locking" \
53 "Mode for locking scheduler during execution is \"on\"."
54
55 foreach_with_prefix thread {5 4 3 2 1} {
56 gdb_test "thread ${thread}" "Switching to .*"
57 gdb_test "call get_value()" "= ${thread}" \
58 "call inferior function"
59 }