231c74b6571d43501ec01ff239cd98ff819d3918
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / exec-invalid-sysroot.exp
1 # Copyright 1997-2019 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 { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
37 untested "failed to compile main testcase"
38 return -1
39 }
40
41 proc do_exec_sysroot_test {} {
42 global binfile srcfile srcfile2 testfile testfile2
43 global gdb_prompt
44
45 gdb_test_no_output "set sysroot /a/path/that/does/not/exist"
46
47 # Start the program running, and stop at main.
48 #
49 if ![runto_main] then {
50 fail "couldn't run ${testfile}"
51 return
52 }
53
54 # Verify that the system supports "catch exec".
55 gdb_test "catch exec" "Catchpoint \[0-9\]* \\(exec\\)" "insert exec catchpoint"
56 set test "continue to exec catchpoint"
57 gdb_test_multiple "continue" $test {
58 -re ".*Your system does not support this type\r\nof catchpoint.*$gdb_prompt $" {
59 unsupported $test
60 return
61 }
62 -re ".*Could not load symbols for executable.*$gdb_prompt $" {
63 pass $test
64 }
65 }
66 }
67
68 # Start with a fresh gdb
69 clean_restart $binfile
70 do_exec_sysroot_test
This page took 0.030141 seconds and 3 git commands to generate.