]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright (C) 2018-2023 Free Software Foundation, Inc. |
d27d16bf RB |
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 | ||
d27d16bf | 21 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
b19f4f61 | 22 | executable {debug additional_flags=-std=gnu99}] != "" } { |
d27d16bf RB |
23 | return -1 |
24 | } | |
25 | ||
26 | clean_restart "${binfile}" | |
27 | ||
b8ffa8b3 | 28 | if {![runto_main]} { |
d27d16bf RB |
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 | } | |
44 | } | |
45 | ||
46 | gdb_breakpoint [gdb_get_line_number "testmarker01"] | |
47 | gdb_continue_to_breakpoint "testmarker01" | |
48 | gdb_test_no_output "set scheduler-locking on" | |
49 | gdb_test "show scheduler-locking" \ | |
50 | "Mode for locking scheduler during execution is \"on\"." | |
51 | ||
52 | foreach_with_prefix thread {5 4 3 2 1} { | |
53 | gdb_test "thread ${thread}" "Switching to .*" | |
9516f85a AB |
54 | gdb_test "call get_value()" "= ${thread}" \ |
55 | "call inferior function" | |
d27d16bf | 56 | } |