]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/interrupt-noterm.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / interrupt-noterm.exp
1 # Copyright (C) 2013-2023 Free Software Foundation, Inc.
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 standard_testfile
17
18 if [prepare_for_testing "failed to prepare for testing" \
19 ${testfile} ${srcfile} {debug}] {
20 return -1
21 }
22
23 # Pretend there's no terminal.
24 gdb_test_no_output "set interactive-mode off"
25
26 if ![runto_main] {
27 return -1
28 }
29
30 # Delete breakpoints so that the next resume is a plain continue,
31 # instead of a step-over-breakpoint sequence just while GDB sends the
32 # interrupt request. If that's buggy on some targets (and it was on
33 # target remote for a while, where a ctrl-c at the wrong time will get
34 # lost), then it should get its own specific test. Disable
35 # confirmation, avoiding complications caused by the fact that we've
36 # disabled the terminal -- GDB would auto-answer "yes", confusing
37 # gdb_test_multiple.
38 gdb_test_no_output "set confirm off"
39 gdb_test_no_output "delete"
40 gdb_test_no_output "set confirm on"
41
42 set async_supported -1
43 set test "continue &"
44 gdb_test_multiple $test $test {
45 -re "Continuing\\.\r\n$gdb_prompt $" {
46 set async_supported 1
47 pass $test
48 }
49 -re ".*Asynchronous execution not supported on this target..*" {
50 unsupported $test
51 }
52 }
53 if { $async_supported < 0 } {
54 return 1
55 }
56
57 # With native debugging, and no terminal (emulated by interactive-mode
58 # off, above), GDB had a bug where "interrupt" would send SIGINT to
59 # its own process group, instead of the inferior's.
60 set test "interrupt"
61 gdb_test_multiple $test $test {
62 -re "interrupt\r\n$gdb_prompt " {
63 pass $test
64 }
65 }
66
67 set test "inferior received SIGINT"
68 gdb_test_multiple "" $test {
69 -re "\r\nProgram received signal SIGINT.*" {
70 # This appears after the prompt, which was already consumed
71 # above.
72 pass $test
73 }
74 }