1# Copyright 2014-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 16standard_testfile 17 18if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { 19 return -1 20} 21 22# Run to main, and execute BODY in the caller's context, with PREFIX 23# set as test message prefix. 24 25proc test { prefix body } { 26 with_test_prefix $prefix { 27 if ![runto_main] { 28 fail "can't run to main" 29 return 0 30 } 31 uplevel 1 $body 32 } 33} 34 35# If GDB forgets to put the inferior's terminal settings into effect 36# while running any of these commands, the program will get a SIGTTOU. 37 38test "next" { 39 gdb_test "next" "set break here.*" "termios ok" 40} 41 42test "infcall" { 43 if ![target_info exists gdb,cannot_call_functions] { 44 gdb_test "print func ()" " = 1" "termios ok" 45 } else { 46 unsupported "cannot call functions" 47 } 48} 49 50test "continue" { 51 set lineno [gdb_get_line_number "set break here"] 52 gdb_test "break $lineno" 53 gdb_test "continue" ".*set break here.*" "termios ok" 54} 55 56test "finish" { 57 gdb_test "break func" "func.*" 58 gdb_test "continue" "func .*" 59 gdb_test "finish" " = 1" "termios ok" 60} 61