Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / multi-target-continue.exp
1 # Copyright 2017-2022 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 "continue" to breakpoints in different targets. In non-stop
17 # mode, also tests "interrupt -a".
18
19 source $srcdir/$subdir/multi-target.exp.tcl
20
21 if {![multi_target_prepare]} {
22 return
23 }
24
25 proc test_continue {non-stop} {
26 if {![setup ${non-stop}]} {
27 untested "setup failed"
28 return
29 }
30
31 proc set_break {inf} {
32 gdb_test "break function${inf} thread ${inf}.1" \
33 "Breakpoint .* function${inf}\\..*"
34 }
35
36 # Select inferior INF, and then run to a breakpoint on inferior
37 # INF+1.
38 proc test_continue_inf {inf} {
39 upvar 1 non-stop non-stop
40
41 global gdb_prompt
42 delete_breakpoints
43
44 set next_inf [next_live_inferior $inf]
45
46 gdb_test "inferior $inf" "Switching to inferior $inf.*"
47 set_break $next_inf
48
49 if {${non-stop} == "off"} {
50 gdb_test "continue" "hit Breakpoint .* function${next_inf}.*"
51 } else {
52 set msg "continue"
53 gdb_test_multiple "continue -a&" $msg {
54 -re "Continuing.*$gdb_prompt " {
55 pass $msg
56 }
57 }
58
59 set msg "hit bp"
60 gdb_test_multiple "" $msg {
61 -re "hit Breakpoint .* function${next_inf}" {
62 pass $msg
63 }
64 }
65
66 set msg "stop all threads"
67 gdb_test_multiple "interrupt -a" $msg {
68 -re "$gdb_prompt " {
69 for {set i 0} {$i < 7} {incr i} {
70 set ok 0
71 gdb_test_multiple "" $msg {
72 -re "Thread\[^\r\n\]*stopped\\." {
73 set ok 1
74 }
75 }
76 if {!$ok} {
77 break
78 }
79 }
80 gdb_assert $ok $msg
81 }
82 }
83 }
84 }
85
86 for {set i 1} {$i <= 5} {incr i} {
87 if {$i == 3} {
88 # This is a core inferior.
89 continue
90 }
91
92 with_test_prefix "inf$i" {
93 test_continue_inf $i
94 }
95 }
96 }
97
98 # Some basic "continue" + breakpoints tests.
99 with_test_prefix "continue" {
100 foreach_with_prefix non-stop {"off" "on"} {
101 test_continue ${non-stop}
102 }
103 }
104
105 multi_target_cleanup
This page took 0.048292 seconds and 4 git commands to generate.