1# Copyright 2015-2016 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# Test that GDB isn't silent if it fails to remove a breakpoint from 17# the main program, independently of whether the program was loaded 18# with "file PROGRAM" or directly from the command line with "gdb 19# PROGRAM". 20 21# Test that execution commands in a GDB script file run through -x 22# work as expected. Specifically, the scripts creates a breakpoint 23# that has "continue" in its command list, and then does "run". 24 25standard_testfile 26 27if {[build_executable "failed to prepare" $testfile $srcfile debug]} { 28 return -1 29} 30 31set x_file ${srcdir}/${subdir}/$testfile.gdb 32 33global GDBFLAGS 34set saved_gdbflags $GDBFLAGS 35 36# Run the test proper. 37 38proc test {} { 39 global inferior_exited_re 40 global binfile 41 global gdb_prompt 42 global saved_gdbflags GDBFLAGS 43 global x_file 44 45 gdb_exit 46 47 set GDBFLAGS "$GDBFLAGS -x $x_file $binfile" 48 49 set GDBFLAGS $saved_gdbflags 50 append GDBFLAGS " -ex \"set height unlimited\"" 51 append GDBFLAGS " -x \"$x_file\"" 52 append GDBFLAGS " --args \"$binfile\"" 53 54 set test "run to end" 55 56 gdb_exit 57 set res [gdb_spawn] 58 if { $res != 0} { 59 fail $test 60 return -1 61 } 62 63 gdb_test_multiple "" $test { 64 -re "$inferior_exited_re normally.*$gdb_prompt $" { 65 pass $test 66 } 67 -re "Don't know how to run.*$gdb_prompt $" { 68 unsupported $test 69 } 70 } 71} 72 73test 74 75set GDBFLAGS $saved_gdbflags 76