OLD | NEW |
(Empty) | |
| 1 # Copyright 2012 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 standard_testfile |
| 17 set executable ${testfile} |
| 18 |
| 19 # Multiple inferiors are needed, therefore both native and extended gdbserver |
| 20 # modes are supported. Only non-extended gdbserver is not supported. |
| 21 if [target_info exists use_gdb_stub] { |
| 22 untested ${testfile}.exp |
| 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 |
| 33 if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executa
ble {debug}] != "" } { |
| 34 untested ${testfile}.exp |
| 35 return -1 |
| 36 } |
| 37 |
| 38 clean_restart $executable |
| 39 |
| 40 # Simulate non-stop+target-async which also uses breakpoint always-inserted. |
| 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 |
| 56 gdb_test "add-inferior" "Added inferior 2" "add inferior 2" |
| 57 gdb_test "inferior 2" "witching to inferior 2 .*" "switch to inferior 2, first t
ime" |
| 58 gdb_load $binfile |
| 59 |
| 60 gdb_breakpoint main {temporary} |
| 61 gdb_test "run" "Temporary breakpoint.* main .*" "start to main inferior 2" |
| 62 |
| 63 gdb_test "awatch c" \ |
| 64 "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c" \ |
| 65 "awatch c on inferior 2" |
| 66 |
| 67 gdb_breakpoint "marker_exit" |
| 68 |
| 69 gdb_test "inferior 1" "witching to inferior 1 .*" "switch back to inferior 1" |
| 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 { |
| 75 gdb_test "awatch b" \ |
| 76 "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b" \ |
| 77 "awatch b on inferior 1" |
| 78 |
| 79 gdb_test "inferior 2" "witching to inferior 2 .*" "switch to inferior 2 agai
n" |
| 80 |
| 81 # FAIL would be a hit on watchpoint for `b' - that one is for the other |
| 82 # inferior. |
| 83 gdb_test "continue" \ |
| 84 "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c\r\n\r\nOld valu
e = 0\r\nNew value = 3\r\n.*" \ |
| 85 "catch c on inferior 2" |
| 86 |
| 87 gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit
in inferior 2" |
| 88 |
| 89 gdb_test "inferior 1" "witching to inferior 1 .*" "switch back to inferior 1
again" |
| 90 |
| 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" |
| 92 } |
| 93 |
| 94 gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in
inferior 1" |
OLD | NEW |