]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/sigwinch-notty.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / sigwinch-notty.exp
CommitLineData
1d506c26 1# Copyright 2021-2024 Free Software Foundation, Inc.
72994b60
LS
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 that GDB does not crash when it is started without a terminal /
17# without readline, and, it receives a SIGWINCH. Regression test for
18# PR gdb/26056.
19
450d26c8 20require {!target_info exists gdb,nosignals}
72994b60
LS
21
22# The testfile relies on "run" from the command line, so only works
23# with "target native".
24if { [target_info gdb_protocol] != "" } {
cdd42066 25 return
72994b60
LS
26}
27
28gdb_exit
29
30# Start GDB without a terminal, running sleep for a while. Before the
31# sleep exits, we'll send a SIGWINCH. "show editing" to double check
32# that readline is disabled.
33save_vars { GDB GDBFLAGS } {
34 set GDB "$srcdir/lib/notty-wrap $GDB"
35 set GDBFLAGS "$GDBFLAGS -ex \"show editing\" -ex run --args sleep 3"
36
37 gdb_spawn
38}
39
40set gdb_pid [exp_pid -i $gdb_spawn_id]
41
42verbose -log "gdb_spawn_id=$gdb_spawn_id"
43verbose -log "gdb_pid=$gdb_pid"
44
45after 1000 {
46 # Note, GDB is started under a shell, so PID is actually the
47 # shell's pid, not GDB's. Use "-PID" to send the signal to the
48 # whole process group and reach GDB, instead of just to the shell.
803392dc 49 remote_exec host "kill -WINCH -${gdb_pid}"
72994b60
LS
50}
51
52# If GDB mishandles the SIGWINCH and crashes, that happens before we
53# see the "inferior exited normally" message, so this will ERROR with
54# eof.
55gdb_test_multiple "" "wait for sleep exit" {
56 -re "Editing of command lines as they are typed is off.*$inferior_exited_re normally.*$gdb_prompt " {
57 pass $gdb_test_name
58 }
59}
60
61gdb_test_multiple "" "wait for gdb exit" {
62 eof {
63 set wait_status [wait -i $gdb_spawn_id]
64 verbose -log "GDB process exited with wait status $wait_status"
65 pass $gdb_test_name
66 }
67}