Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-threads-interrupt.exp
CommitLineData
88b9d363 1# Copyright 2016-2022 Free Software Foundation, Inc.
9e8f9b05
SM
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
b3b7c423
SL
16if [target_info exists gdb,nointerrupts] {
17 verbose "Skipping mi-threads-interrupt.exp because of nointerrupts."
18 continue
19}
20
9e8f9b05
SM
21load_lib mi-support.exp
22set MIFLAGS "-i=mi"
23
24standard_testfile
25
26if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } {
27 return -1
28}
29
30# This tests the resolution of PR 20039.
31#
32# With a multi-threaded inferior and with MI/all-stop, it was not possible
33# to interrupt it with ctrl-C after a continue.
34
35proc test_continue_interrupt { } {
36 global binfile
37 global async
38
39 gdb_exit
40 if {[mi_gdb_start]} {
41 continue
42 }
43
44 # Load the binary in gdb...
45 mi_gdb_load $binfile
46
47 # ... and run it.
48 #
49 # Note this test relies on mi_runto deleting the breakpoint.
50 # A step-over here would mask the bug.
51 mi_runto "all_threads_created"
52
53 # Consistency check.
54 mi_check_thread_states {"stopped" "stopped" "stopped"} "check thread states"
55
56 # Continue.
57 mi_send_resuming_command "exec-continue" "continue"
58
59 # Wait a bit to make sure all MI events are sent, before sending the
60 # interruption request.
61 sleep 1
62
63 # Send the interrupt request.
64 if { $async } {
65 mi_gdb_test "888-exec-interrupt" "888\\^done" "interrupt"
66 } else {
67 send_gdb "\003"
68 }
69
70 # Wait for the *stopped.
71 mi_expect_interrupt "interrupt reported"
72}
73
74test_continue_interrupt
This page took 0.736229 seconds and 4 git commands to generate.