1 # Copyright
(C
) 2014-2019 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Test spawning a subshell from a multi
-line command
, where the last
17 # prompt displayed is a secondary prompt. GDB used to have a bug
18 # where in this case the subshell would start with the wrong terminal
19 # settings. See PR python
/17372.
24 # The subshell
's prompt.
25 set shell_prompt "gdb-subshell$ "
26 set shell_prompt_re [string_to_regexp $shell_prompt]
28 # Point HOME nowhere to avoid the shell sourcing the user's init
30 set shell_cmd
"HOME=/dev/null PS1=\"$shell_prompt\" /bin/sh"
32 set test
"spawn subshell from multi-line"
33 gdb_test_multiple
"if 1\nshell ${shell_cmd}\nend" $test {
34 -re
"$shell_prompt_re$" {
37 # Now check that
shell input works and that echo is enabled.
38 set test
"shell input works"
41 -re
"^echo foo\r\nfoo\r\n$shell_prompt_re$" {
45 fail
"$test (timeout)"
49 # Exit the subshell
, back to GDB
50 gdb_test
"exit" ".*" "exit shell"
54 # Check that we restore input in GDB correctly.
55 gdb_test
"print 1" "^print 1\r\n.. = 1" "gdb input still works"