]>
Commit | Line | Data |
---|---|---|
3666a048 | 1 | # Copyright 2017-2021 Free Software Foundation, Inc. |
e11daf7a PA |
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 "next" bouncing between two breakpoints in two threads running | |
17 | # in different targets. | |
18 | ||
19 | source $srcdir/$subdir/multi-target.exp.tcl | |
20 | ||
21 | if {![multi_target_prepare]} { | |
22 | return | |
23 | } | |
24 | ||
25 | proc test_ping_pong_next {} { | |
26 | global srcfile | |
27 | ||
28 | if {![setup "off"]} { | |
29 | untested "setup failed" | |
30 | return | |
31 | } | |
32 | ||
33 | # Block/unblock inferiors 1 and 2 according to INF1 and INF2. | |
34 | proc block {inf1 inf2} { | |
35 | gdb_test "thread apply 1.1 p wait_for_gdb = $inf1" " = $inf1" | |
36 | gdb_test "thread apply 2.1 p wait_for_gdb = $inf2" " = $inf2" | |
37 | } | |
38 | ||
39 | # We'll use inferiors 1 and 2. Make sure they're really connected | |
40 | # to different targets. | |
41 | gdb_test "thread apply 1.1 maint print target-stack" \ | |
42 | "- native.*" | |
43 | gdb_test "thread apply 2.1 maint print target-stack" \ | |
44 | "- extended-remote.*" | |
45 | ||
46 | # Set two breakpoints, one for each of inferior 1 and 2. Inferior | |
47 | # 1 is running on the native target, and inferior 2 is running on | |
48 | # extended-gdbserver. Run to breakpoint 1 to gets things started. | |
49 | set line1 [gdb_get_line_number "set break 1 here"] | |
50 | set line2 [gdb_get_line_number "set break 2 here"] | |
51 | ||
52 | gdb_test "thread 1.1" "Switching to thread 1.1 .*" | |
53 | ||
54 | gdb_test "break $srcfile:$line1 thread 1.1" \ | |
55 | "Breakpoint .*$srcfile:$line1\\..*" | |
56 | ||
57 | gdb_test "continue" "hit Breakpoint .*" | |
58 | ||
59 | gdb_test "break $srcfile:$line2 thread 2.1" \ | |
60 | "Breakpoint .*$srcfile:$line2\\..*" | |
61 | ||
62 | # Now block inferior 1 and issue "next". We should stop at the | |
63 | # breakpoint for inferior 2, given schedlock off. | |
64 | with_test_prefix "next inf 1" { | |
65 | block 1 0 | |
66 | gdb_test "next" "Thread 2.1 .*hit Breakpoint .*$srcfile:$line2.*" | |
67 | } | |
68 | ||
69 | # Now unblock inferior 2 and block inferior 1. "next" should run | |
70 | # into the breakpoint in inferior 1. | |
71 | with_test_prefix "next inf 2" { | |
72 | block 0 1 | |
73 | gdb_test "next" "Thread 1.1 .*hit Breakpoint .*$srcfile:$line1.*" | |
74 | } | |
75 | ||
76 | # Try nexting inferior 1 again. | |
77 | with_test_prefix "next inf 1 again" { | |
78 | block 1 0 | |
79 | gdb_test "next" "Thread 2.1 .*hit Breakpoint .*$srcfile:$line2.*" | |
80 | } | |
81 | } | |
82 | ||
83 | test_ping_pong_next | |
84 | ||
85 | multi_target_cleanup |