gdb
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / gdb11531.exp
CommitLineData
bdf92a1c
PM
1# This testcase is part of GDB, the GNU debugger.
2
7b6bb8da 3# Copyright 2010, 2011 Free Software Foundation, Inc.
bdf92a1c
PM
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18# Test GDB bug report 11531.
19# This is a problem related to CANNOT_STEP_HW_WATCHPOINTS macro.
20# It affects Solaris native targets.
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
bdf92a1c
PM
26
27set testfile "gdb11531"
28
29if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug}] } {
30 return -1;
31}
32
e0756905
UW
33# Disable hardware watchpoints if necessary.
34if [target_info exists gdb,no_hardware_watchpoints] {
35 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
36}
bdf92a1c
PM
37
38if { ![runto main] } then {
39 fail "run to main"
40 return
41}
42
43# The breakpoint is probably at the instruction where the value being
44# watched (myrec.x) gets updated. This is the instruction where we
45# expect to receive a watchpoint notification when we do the "stepi"
46# below. However, having the breakpoint at the same location as this
47# intruction can possibly interfere with our testcase, as stepping
48# over the breakpoint in order to get past it may incorrectly lead
49# to the debugger missing the watchpoint hit. This would be a bug
50# in GDB, but this is not the bug that we are trying to test here.
51# So, we remove all breakpoints first.
52
53delete_breakpoints
54
55set nl "\[\r\n\]+"
56
57gdb_test "watch myrec.x" ".*atchpoint \[0-9\]+: myrec\.x" "Set watchpoint"
58
59gdb_test "next" \
60 ".*${nl}.*atchpoint \[0-9\]+: myrec\.x${nl}Old value = 0${nl}New value = 5${nl}.*" \
61 "watchpoint variable triggers at next"
62
63gdb_test "continue" \
64 ".*${nl}.*atchpoint \[0-9\]+: myrec\.x${nl}Old value = 5${nl}New value = 78${nl}.*" \
65 "watchpoint variable triggers at continue"
66
This page took 0.150732 seconds and 4 git commands to generate.