1 # Copyright 2016-2024 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 require {!target_info exists gdb,nointerrupts} 17 18 load_lib mi-support.exp 19 set MIFLAGS "-i=mi" 20 21 standard_testfile 22 23 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } { 24 return -1 25 } 26 27 # This tests the resolution of PR 20039. 28 # 29 # With a multi-threaded inferior and with MI/all-stop, it was not possible 30 # to interrupt it with ctrl-C after a continue. 31 32 proc test_continue_interrupt { } { 33 global binfile 34 global async 35 36 if {[mi_clean_restart $binfile]} { 37 return 38 } 39 40 # ... and run it. 41 # 42 # Note this test relies on mi_runto deleting the breakpoint. 43 # A step-over here would mask the bug. 44 mi_runto "all_threads_created" 45 46 # Consistency check. 47 mi_check_thread_states {"stopped" "stopped" "stopped"} "check thread states" 48 49 # Continue. 50 mi_send_resuming_command "exec-continue" "continue" 51 52 # Wait a bit to make sure all MI events are sent, before sending the 53 # interruption request. 54 sleep 1 55 56 # Send the interrupt request. 57 if { $async } { 58 mi_gdb_test "888-exec-interrupt" "888\\^done" "interrupt" 59 } else { 60 send_gdb "\003" 61 } 62 63 # Wait for the *stopped. 64 mi_expect_interrupt "interrupt reported" 65 } 66 67 test_continue_interrupt 68