]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / run-with-two-mi-uis.exp
1 # Copyright 2023-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 # Test doing an -exec-run while there are two MI UIs.
17
18 load_lib mi-support.exp
19
20 standard_testfile
21
22 if {[build_executable $testfile.exp $testfile ${srcfile} "debug"] == -1} {
23 untested "failed to compile"
24 return
25 }
26
27 # Run one configuration of the test.
28 #
29 # UI_TO_RUN is the UI that should issue the run command.
30
31 proc do_test { ui_to_run } {
32 if {[mi_clean_restart $::binfile "separate-mi-tty"] != 0} {
33 fail "could not start gdb"
34 return
35 }
36
37 with_spawn_id $::gdb_main_spawn_id {
38 lassign [create_mi_ui] second_mi_spawn_id second_mi_tty_name
39 }
40
41 with_spawn_id $second_mi_spawn_id {
42 gdb_expect {
43 -re "=thread-group-added,id=\"i1\"\r\n$::mi_gdb_prompt$" {
44 pass "consume"
45 }
46 }
47 }
48
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
53 } else {
54 error "invalid ui_to_run value"
55 }
56
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.
60 mi_runto_main
61 }
62 }
63
64 foreach_with_prefix ui_to_run {first second} {
65 do_test $ui_to_run
66 }
67