]>
Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2012-2020 Free Software Foundation, Inc. |
d0d8b0c6 JK |
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 | ||
7bb18ae2 TT |
16 | standard_testfile |
17 | set executable ${testfile} | |
d0d8b0c6 JK |
18 | |
19 | # Multiple inferiors are needed, therefore both native and extended gdbserver | |
20 | # modes are supported. Only non-extended gdbserver is not supported. | |
079670b9 | 21 | if [use_gdb_stub] { |
5b362f04 | 22 | untested "using gdb stub" |
d0d8b0c6 JK |
23 | return |
24 | } | |
25 | ||
26 | # Do not use simple hardware watchpoints ("watch") as its false hit may be | |
27 | # unnoticed by GDB if it reads it still has the same value. | |
28 | if [skip_hw_watchpoint_access_tests] { | |
29 | untested "${testfile} (no hardware access watchpoints)" | |
30 | return | |
31 | } | |
32 | ||
d0d8b0c6 | 33 | if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
5b362f04 | 34 | untested "failed to compile" |
d0d8b0c6 JK |
35 | return -1 |
36 | } | |
37 | ||
38 | clean_restart $executable | |
39 | ||
329ea579 | 40 | # Simulate non-stop which also uses breakpoint always-inserted. |
d0d8b0c6 JK |
41 | gdb_test_no_output "set breakpoint always-inserted on" |
42 | # displaced-stepping is also needed as other GDB sometimes still removes the | |
43 | # breakpoints, even with always-inserted on. | |
44 | # Without the support this test just is not as thorough as it could be. | |
45 | if [support_displaced_stepping] { | |
46 | gdb_test_no_output "set displaced-stepping on" | |
47 | } | |
48 | ||
49 | # Debugging of this testcase: | |
50 | #gdb_test_no_output "maintenance set show-debug-regs on" | |
51 | #gdb_test_no_output "set debug infrun 1" | |
52 | ||
53 | gdb_breakpoint main {temporary} | |
54 | gdb_test "run" "Temporary breakpoint.* main .*" "start to main inferior 1" | |
55 | ||
121b3efd | 56 | gdb_test "add-inferior" "Added inferior 2 on connection .*" "add inferior 2" |
3d7f4b81 | 57 | gdb_test "inferior 2" "witching to inferior 2 .*" "switch to inferior 2, first time" |
d0d8b0c6 JK |
58 | gdb_load $binfile |
59 | ||
60 | gdb_breakpoint main {temporary} | |
61 | gdb_test "run" "Temporary breakpoint.* main .*" "start to main inferior 2" | |
62 | ||
3d7f4b81 PA |
63 | gdb_test "awatch c" \ |
64 | "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c" \ | |
65 | "awatch c on inferior 2" | |
d0d8b0c6 JK |
66 | |
67 | gdb_breakpoint "marker_exit" | |
68 | ||
3d7f4b81 | 69 | gdb_test "inferior 1" "witching to inferior 1 .*" "switch back to inferior 1" |
d0d8b0c6 JK |
70 | |
71 | if [skip_hw_watchpoint_multi_tests] { | |
72 | # On single hardware watchpoint at least test the watchpoint in inferior | |
73 | # 2 is not hit. | |
74 | } else { | |
3d7f4b81 PA |
75 | gdb_test "awatch b" \ |
76 | "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b" \ | |
77 | "awatch b on inferior 1" | |
d0d8b0c6 | 78 | |
3d7f4b81 | 79 | gdb_test "inferior 2" "witching to inferior 2 .*" "switch to inferior 2 again" |
d0d8b0c6 JK |
80 | |
81 | # FAIL would be a hit on watchpoint for `b' - that one is for the other | |
82 | # inferior. | |
3d7f4b81 PA |
83 | gdb_test "continue" \ |
84 | "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c\r\n\r\nOld value = 0\r\nNew value = 3\r\n.*" \ | |
85 | "catch c on inferior 2" | |
d0d8b0c6 JK |
86 | |
87 | gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 2" | |
88 | ||
3d7f4b81 | 89 | gdb_test "inferior 1" "witching to inferior 1 .*" "switch back to inferior 1 again" |
d0d8b0c6 | 90 | |
3d7f4b81 | 91 | gdb_test "continue" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n\r\nOld value = 0\r\nNew value = 2\r\n.*" "catch b on inferior 1" |
d0d8b0c6 JK |
92 | } |
93 | ||
94 | gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 1" |