1# Copyright 2009-2015 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# The intent of this testcase is to verify that GDB does not keep 17# a filesystem lock on the executable file once the executable 18# is no longer running. 19 20standard_testfile arrayidx.c 21# $EXEEXT suffix is needed here, because otherwise, Windows targets 22# don't find the $binfile for 'file delete $binfile'. 23append binfile $EXEEXT 24 25if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { 26 untested "Couldn't compile ${srcfile}" 27 return -1 28} 29 30clean_restart ${binfile} 31 32# Sanity-check: Verify that the executable exists. This is just to 33# make sure that, when we verify later that the file does not exist, 34# it really has been deleted. 35if { ! [file exists $binfile] } { 36 fail "executable does not exist (${binfile})" 37 return -1 38 } 39 40if ![runto_main] then { 41 perror "couldn't run to breakpoint" 42 continue 43} 44 45gdb_continue_to_end 46 47# Try deleting the executable file, now that the program has exited, 48# and make sure that the deletion worked by verifying that the exe 49# is no longer there (the "file delete" tcl command does not return 50# any status, apparently). 51file delete $binfile 52if { [file exists $binfile] } { 53 fail "executable still exists (${binfile})" 54 } 55 56 57