1 # Copyright 2016-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 if [target_info exists gdb,nointerrupts] { 17 verbose "Skipping mi-threads-interrupt.exp because of nointerrupts." 18 return 19 } 20 21 load_lib mi-support.exp 22 set MIFLAGS "-i=mi" 23 24 standard_testfile 25 26 if {[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 35 proc test_continue_interrupt { } { 36 global binfile 37 global async 38 39 gdb_exit 40 if {[mi_gdb_start]} { 41 return 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 74 test_continue_interrupt 75