warn if "source" fails to open the file when from_tty == 0
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watchpoints.exp
CommitLineData
28e7fd62 1# Copyright 2009-2013 Free Software Foundation, Inc.
087b74b2
PM
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# This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
17
087b74b2 18
62cef515 19standard_testfile
087b74b2
PM
20
21set wp_set 1
22
4c93b1db 23if [get_compiler_info] {
087b74b2
PM
24 return -1
25}
26
62cef515
TT
27if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
28 untested $testfile.exp
29 return -1
087b74b2
PM
30}
31
b32306ca
UW
32 # Disable hardware watchpoints if necessary.
33 if [target_info exists gdb,no_hardware_watchpoints] {
35ec993f 34 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
b32306ca
UW
35 }
36
087b74b2 37 runto_main
de7ff789
MS
38 gdb_test "watch ival1" ".*" ""
39 gdb_test "watch ival3" ".*" ""
087b74b2 40
97f2ed50 41 set prev_timeout $timeout
087b74b2
PM
42 set timeout 600
43
44 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = -1.*New value = 0.*ival1 = count; ival2 = count;.*" "watchpoint hit, first time"
45
46 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit, first time"
47
48 # Check that the ival3 hit count is reported correctly
49 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 1 time.*" "Watchpoint hit count is 1"
50
51 # Continue until the next change for ival1, from 0 to 1.
52 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 0.*New value = 1.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, second time"
53
54 # Check that the hit count for ival1 is reported correctly
55 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 2 times.*" "Watchpoint ival1 hit count is 2"
56
57 # Continue until the next change for ival3, from 0 to 1.
58 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time"
59
60 # Check that the hit count is reported correctly
61 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 2 times.*" "Watchpoint hit count is 2"
62
63 # Continue until the next change, from 1 to 2.
64 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 1.*New value = 2.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, third time"
65
66 # Check that the hit count is reported correctly
67 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "Watchpoint ival1 hit count is 3"
68 # Disable ival1 watchpoint
35ec993f 69 gdb_test_no_output "disable 2" ""
087b74b2
PM
70
71 # Continue until the next change, from 1 to 2.
72 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
73
74 # Check that the hit count is reported correctly
75 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "Watchpoint hit count is 3"
76
77 # Continue until the next change, from 2 to 3.
78 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
79
80 # Check that the hit count is reported correctly
81 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 4 times.*" "Watchpoint hit count is 4"
82
83 # Continue until the next change, from 3 to 4.
84 # Note that this one is outside the loop.
85
86 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time"
87
88 # Check that the hit count is reported correctly
89 gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 5 times.*" "Watchpoint hit count is 5"
90
97f2ed50 91set timeout $prev_timeout
This page took 0.487989 seconds and 4 git commands to generate.