]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
Update Copyright year range in all files maintained by GDB.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dwp-symlink.exp
CommitLineData
ecd75fc8 1# Copyright 2013-2014 Free Software Foundation, Inc.
82bf32bc
JK
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
16standard_testfile
17
18if [is_remote host] {
19 untested "remote host"
20 return 0
21}
22
23file delete [standard_output_file ${testfile}.dwp]
24if [file exists [standard_output_file ${testfile}.dwp]] {
25 unsupported "dwp file cannot be deleted"
26 return 0
27}
28if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
29 return -1
30}
31if ![file exists [standard_output_file ${testfile}.dwp]] {
32 unsupported "testsuite run does not produce dwp files"
33 return 0
34}
35
36set thelink "${testfile}-thelink"
37
38file delete [standard_output_file ${thelink}]
39file delete [standard_output_file ${thelink}.dwp]
40# file link is only Tcl 8.4+.
41exec "ln" "-sf" "${testfile}" "[standard_output_file $thelink]"
42if ![file exists [standard_output_file $thelink]] {
43 unsupported "host does not support symbolic links (binary symlink is missing)"
44 return 0
45}
46if [file exists [standard_output_file $thelink.dwp]] {
47 unsupported "host does not support symbolic links (we tried to delete a file and it is still there)"
48 return 0
49}
50
51clean_restart "$testfile"
52
53gdb_test "ptype main" {type = int \(int, char \*\*\)} "binary default, dwp default"
54
55clean_restart "$thelink"
56
57gdb_test "ptype main" {type = int \(int, char \*\*\)} "binary symlink, dwp default"
58
59gdb_exit
60file rename [standard_output_file ${testfile}.dwp] [standard_output_file ${thelink}.dwp]
61if [file exists [standard_output_file ${testfile}.dwp]] {
62 unsupported "host does not support symbolic links (binary symlink exists)"
63 return 0
64}
65if ![file exists [standard_output_file ${thelink}.dwp]] {
66 unsupported "host does not support symbolic links (dwp symlink is missing)"
67 return 0
68}
69
70clean_restart "$testfile"
71
72# This case cannot work.
73gdb_test "ptype main" {type = int \(\)} "binary default, dwp at symlink"
74
75clean_restart "$thelink"
76
77gdb_test "ptype main" {type = int \(int, char \*\*\)} "binary symlink, dwp at symlink"
04affae3
JK
78
79# Verify we can still find the dwp if we change directories and we specified
80# a relative path for the program.
81
82set saved_pwd [pwd]
83
84# This is clean_restart, but specifying a relative path to the binary.
85gdb_exit
86gdb_start
87gdb_reinitialize_dir $srcdir/$subdir
88gdb_test "cd [file dirname [standard_output_file ${thelink}]]" \
89 "Working directory .*"
90gdb_load "./${thelink}"
91
92gdb_test "cd .." "Working directory .*"
93
94gdb_test "ptype main" {type = int \(int, char \*\*\)} \
95 "relative path, binary symlink, dwp at symlink"
96
97cd $saved_pwd