1# Copyright (C) 2018-2020 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 19standard_testfile 20 21if [get_compiler_info] { 22 return -1 23} 24 25if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ 26 executable {debug}] != "" } { 27 return -1 28} 29 30clean_restart "${binfile}" 31 32if ![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. 40gdb_breakpoint [gdb_get_line_number "prethreadcreationmarker"] 41gdb_continue_to_breakpoint "prethreadcreationmarker" 42set after_new_thread_message "created new thread" 43foreach_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 51gdb_breakpoint [gdb_get_line_number "testmarker01"] 52gdb_continue_to_breakpoint "testmarker01" 53gdb_test_no_output "set scheduler-locking on" 54gdb_test "show scheduler-locking" \ 55 "Mode for locking scheduler during execution is \"on\"." 56 57foreach_with_prefix thread {5 4 3 2 1} { 58 gdb_test "thread ${thread}" "Switching to .*" 59 gdb_test "call get_value()" "= ${thread}" \ 60 "call inferior function" 61} 62