1 # Copyright 2023-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test doing an -exec-run while there are two MI UIs.
18 load_lib mi-support.exp
22 if {[build_executable $testfile.exp $testfile ${srcfile} "debug"] == -1} {
23 untested "failed to compile"
27 # Run one configuration of the test.
29 # UI_TO_RUN is the UI that should issue the run command.
31 proc do_test { ui_to_run } {
32 if {[mi_clean_restart $::binfile "separate-mi-tty"] != 0} {
33 fail "could not start gdb"
37 with_spawn_id $::gdb_main_spawn_id {
38 lassign [create_mi_ui] second_mi_spawn_id second_mi_tty_name
41 with_spawn_id $second_mi_spawn_id {
43 -re "=thread-group-added,id=\"i1\"\r\n$::mi_gdb_prompt$" {
49 if { $ui_to_run == "first" } {
50 set spawn_id_to_run $::mi_spawn_id
51 } elseif { $ui_to_run == "second" } {
52 set spawn_id_to_run $second_mi_spawn_id
54 error "invalid ui_to_run value"
57 with_spawn_id $spawn_id_to_run {
58 # mi_runto_main implicitly verifies that the UI doing the -exec-run gets
59 # the expected ^running record.
64 foreach_with_prefix ui_to_run {first second} {