2013-04-24 Muhammad Bilal <mbilal@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / exe-lock.exp
CommitLineData
28e7fd62 1# Copyright 2009-2013 Free Software Foundation, Inc.
d12672cc
JB
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
d12672cc
JB
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
20set testfile "arrayidx"
21set srcfile ${testfile}.c
3a72a602
PM
22# $EXEEXT suffix is needed here, because otherwise, Windows targets
23# don't find the $binfile for 'file delete $binfile'.
24set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
25
d12672cc
JB
26if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
27 untested "Couldn't compile ${srcfile}"
28 return -1
29}
30
31gdb_exit
32gdb_start
33gdb_reinitialize_dir $srcdir/$subdir
34gdb_load ${binfile}
35
36# Sanity-check: Verify that the executable exists. This is just to
37# make sure that, when we verify later that the file does not exist,
38# it really has been deleted.
39if { ! [file exists $binfile] } {
40 fail "executable does not exist (${binfile})"
41 return -1
42 }
43
44if ![runto_main] then {
45 perror "couldn't run to breakpoint"
46 continue
47}
48
fda326dd 49gdb_continue_to_end
d12672cc
JB
50
51# Try deleting the executable file, now that the program has exited,
52# and make sure that the deletion worked by verifying that the exe
53# is no longer there (the "file delete" tcl command does not return
54# any status, apparently).
55file delete $binfile
56if { [file exists $binfile] } {
57 fail "executable still exists (${binfile})"
58 }
59
60
This page took 0.478396 seconds and 4 git commands to generate.