Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / detach-sysroot-target.exp
CommitLineData
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
23standard_testfile
24
25if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
26 return
27}
28
29gdb_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
51if ![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".
58set escapedbinfile [string_to_regexp ${binfile}]
59gdb_test "detach" "Detaching from program: .*$escapedbinfile, .*"
This page took 0.039458 seconds and 4 git commands to generate.