Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright (C) 2018-2020 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 | ||
21 | if [get_compiler_info] { | |
22 | return -1 | |
23 | } | |
24 | ||
25 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ | |
26 | executable {debug}] != "" } { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | clean_restart "${binfile}" | |
31 | ||
32 | if ![runto_main] then { | |
33 | fail "can't run to main" | |
34 | return 0 | |
35 | } | |
36 | ||
37 | # Ensure that each new thread is detected by GDB in the order that the | |
38 | # test case creates them, so the thread identifiers match between | |
39 | # test and test case. | |
40 | gdb_breakpoint [gdb_get_line_number "prethreadcreationmarker"] | |
41 | gdb_continue_to_breakpoint "prethreadcreationmarker" | |
42 | set after_new_thread_message "created new thread" | |
43 | foreach_with_prefix thread {5 4 3} { | |
44 | gdb_test_multiple "continue" "${after_new_thread_message}" { | |
45 | -re "\\\[New Thread ${hex} \\\(LWP \[0-9\]+\\\)\\\].*${gdb_prompt}" { | |
46 | pass "${after_new_thread_message}" | |
47 | } | |
48 | } | |
49 | } | |
50 | ||
51 | gdb_breakpoint [gdb_get_line_number "testmarker01"] | |
52 | gdb_continue_to_breakpoint "testmarker01" | |
53 | gdb_test_no_output "set scheduler-locking on" | |
54 | gdb_test "show scheduler-locking" \ | |
55 | "Mode for locking scheduler during execution is \"on\"." | |
56 | ||
57 | foreach_with_prefix thread {5 4 3 2 1} { | |
58 | gdb_test "thread ${thread}" "Switching to .*" | |
9516f85a AB |
59 | gdb_test "call get_value()" "= ${thread}" \ |
60 | "call inferior function" | |
d27d16bf | 61 | } |