Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / exec-invalid-sysroot.exp
CommitLineData
88b9d363 1# Copyright 1997-2022 Free Software Foundation, Inc.
ecf45d2c
SL
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
20standard_testfile foll-exec.c
21
22global binfile
23set binfile [standard_output_file "foll-exec"]
24set testfile2 "execd-prog"
25set srcfile2 ${testfile2}.c
26set binfile2 [standard_output_file ${testfile2}]
27
28set compile_options debug
29
30# build the first test case
31if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $compile_options] != "" } {
84c93cd5 32 untested "failed to compile secondary testcase"
ecf45d2c
SL
33 return -1
34}
35
36if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } {
84c93cd5 37 untested "failed to compile main testcase"
ecf45d2c
SL
38 return -1
39}
40
41proc 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 {
bc6c7af4 50 fail "couldn't run ${testfile}"
ecf45d2c
SL
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
69clean_restart $binfile
70do_exec_sysroot_test
This page took 0.964799 seconds and 4 git commands to generate.