Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 2009-2012 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 | ||
20 | set testfile "arrayidx" | |
21 | set 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'. | |
24 | set binfile ${objdir}/${subdir}/${testfile}$EXEEXT | |
25 | ||
d12672cc JB |
26 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
27 | untested "Couldn't compile ${srcfile}" | |
28 | return -1 | |
29 | } | |
30 | ||
31 | gdb_exit | |
32 | gdb_start | |
33 | gdb_reinitialize_dir $srcdir/$subdir | |
34 | gdb_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. | |
39 | if { ! [file exists $binfile] } { | |
40 | fail "executable does not exist (${binfile})" | |
41 | return -1 | |
42 | } | |
43 | ||
44 | if ![runto_main] then { | |
45 | perror "couldn't run to breakpoint" | |
46 | continue | |
47 | } | |
48 | ||
fda326dd | 49 | gdb_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). | |
55 | file delete $binfile | |
56 | if { [file exists $binfile] } { | |
57 | fail "executable still exists (${binfile})" | |
58 | } | |
59 | ||
60 |