]>
Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 2009-2018 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 | ||
289f9037 | 20 | standard_testfile arrayidx.c |
3a72a602 PM |
21 | # $EXEEXT suffix is needed here, because otherwise, Windows targets |
22 | # don't find the $binfile for 'file delete $binfile'. | |
289f9037 | 23 | append binfile $EXEEXT |
3a72a602 | 24 | |
d12672cc | 25 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
84c93cd5 | 26 | untested "failed to compile" |
d12672cc JB |
27 | return -1 |
28 | } | |
29 | ||
289f9037 | 30 | clean_restart ${binfile} |
d12672cc JB |
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. | |
35 | if { ! [file exists $binfile] } { | |
36 | fail "executable does not exist (${binfile})" | |
37 | return -1 | |
38 | } | |
39 | ||
40 | if ![runto_main] then { | |
41 | perror "couldn't run to breakpoint" | |
42 | continue | |
43 | } | |
44 | ||
fda326dd | 45 | gdb_continue_to_end |
d12672cc JB |
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). | |
51 | file delete $binfile | |
52 | if { [file exists $binfile] } { | |
53 | fail "executable still exists (${binfile})" | |
54 | } | |
55 | ||
56 |