]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / paginate-after-ctrl-c-running.exp
CommitLineData
213516ef 1# Copyright (C) 2014-2023 Free Software Foundation, Inc.
82584158
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
87a3a92c
SL
16if [target_info exists gdb,nointerrupts] {
17 verbose "Skipping paginate-after-ctrl-c-running.exp because of nointerrupts."
18 return
19}
20
82584158
PA
21standard_testfile
22
23if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
24 return -1
25}
26
b78b3a29
TBA
27# Send a ctrl-c while the target is running and check that the output
28# does not cause a pagination prompt.
82584158 29
b78b3a29 30proc test_ctrlc_while_target_running_does_not_paginate {} {
82584158 31 global binfile srcfile
b78b3a29 32 global gdb_prompt
82584158
PA
33
34 set testline [gdb_get_line_number "after sleep"]
35
36 with_test_prefix "ctrlc target running" {
37 clean_restart $binfile
38
65a33d75 39 if {![runto_main]} {
82584158
PA
40 return 0
41 }
42
43 gdb_test "b $srcfile:$testline" \
44 "Breakpoint .*$srcfile, line $testline.*" \
45 "set breakpoint"
46
47 gdb_test_no_output "set height 2"
48
49 # Wait for the "Continuing" line, indicating the program is
50 # running.
51 set test "continue"
52 gdb_test_multiple $test $test {
53 -re "Continuing" {
54 pass $test
55 }
56 }
57
58 # The program sleeps 10 seconds. Wait just a bit and send a
59 # ctrl-c.
60 sleep 2
61 send_gdb "\003"
62
63 # GDB now intercepts the SIGINT and tries to let the user know
b78b3a29
TBA
64 # about the spurious signal. Make sure that this does not
65 # trigger pagination.
66 gdb_test_multiple "" "no pagination" {
82584158 67 -re "$gdb_prompt $" {
b78b3a29 68 pass $gdb_test_name
82584158 69 }
82584158
PA
70 }
71
72 # Confirm GDB can still process input.
73 gdb_test "p 1" " = 1" "GDB accepts further input"
74
75 # In case the board file wants to send further commands.
76 gdb_test_no_output "set height unlimited"
77 }
78}
79
b78b3a29 80test_ctrlc_while_target_running_does_not_paginate