Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2021-2022 Free Software Foundation, Inc. |
97c5ca8c PA |
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 | # Test running a program from the GDB prompt and then detaching it, | |
17 | # with "set sysroot target:". Regression test for PR gdb/28080. | |
18 | # | |
19 | # It is assumed that it is only safe to tweak the sysroot on the | |
20 | # current board if it is currently either empty or already "target:". | |
21 | # If set to anything else, we skip the test. | |
22 | ||
23 | standard_testfile | |
24 | ||
25 | if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} { | |
26 | return | |
27 | } | |
28 | ||
29 | gdb_test_multiple "show sysroot" "" { | |
30 | -wrap -re "The current system root is \"\"\\." { | |
31 | pass $gdb_test_name | |
32 | ||
33 | # Explicitly set target: sysroot. | |
34 | gdb_test_no_output "set sysroot target:" | |
35 | } | |
36 | -wrap -re "The current system root is \"target:\"\\." { | |
37 | pass $gdb_test_name | |
38 | ||
39 | # Nothing else to do. | |
40 | } | |
41 | -re "$gdb_prompt $" { | |
42 | pass $gdb_test_name | |
43 | ||
44 | # If testing with any other sysroot, we probably should not | |
45 | # mess with it. | |
46 | unsupported "sysroot is set" | |
47 | return | |
48 | } | |
49 | } | |
50 | ||
51 | if ![runto_main] { | |
52 | fail "couldn't run to main" | |
53 | return | |
54 | } | |
55 | ||
56 | # With PR gdb/28080, this would crash GDB when testing with "target | |
57 | # remote". | |
58 | set escapedbinfile [string_to_regexp ${binfile}] | |
59 | gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*" |