]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/exec-invalid-sysroot.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / exec-invalid-sysroot.exp
1 # Copyright 1997-2023 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 # This test exercises PR20569. GDB would crash when attempting to follow
17 # an exec call when it could not resolve the path to the symbol file.
18 # This was the case when an invalid sysroot is provided.
19
20 standard_testfile foll-exec.c
21
22 global binfile
23 set binfile [standard_output_file "foll-exec"]
24 set testfile2 "execd-prog"
25 set srcfile2 ${testfile2}.c
26 set binfile2 [standard_output_file ${testfile2}]
27
28 set compile_options debug
29
30 # build the first test case
31 if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $compile_options] != "" } {
32 untested "failed to compile secondary testcase"
33 return -1
34 }
35
36 if { [is_remote target] } {
37 gdb_remote_download target $binfile2
38 }
39
40 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
41 untested "failed to compile main testcase"
42 return -1
43 }
44
45 proc do_exec_sysroot_test {} {
46 global binfile srcfile srcfile2 testfile testfile2
47 global gdb_prompt
48
49 gdb_test_no_output "set sysroot /a/path/that/does/not/exist"
50
51 # Start the program running, and stop at main.
52 #
53 if {![runto_main]} {
54 return
55 }
56
57 # Verify that the system supports "catch exec".
58 gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert exec catchpoint"
59 set test "continue to exec catchpoint"
60 gdb_test_multiple "continue" $test {
61 -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
62 unsupported $test
63 return
64 }
65 -re ".*Could not load symbols for executable.*$gdb_prompt $" {
66 pass $test
67 }
68 }
69 }
70
71 # Start with a fresh gdb
72 clean_restart $binfile
73 do_exec_sysroot_test