gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watchpoint-hw.exp
1 # Copyright 2008, 2009, 2010, 2011 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 # Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
17 if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
18 && ![istarget "ia64-*-*"] && ![istarget "s390*-*-*"])
19 || [target_info exists gdb,no_hardware_watchpoints]} then {
20 verbose "Skipping watchpoint-hw test."
21 return
22 }
23
24 set testfile watchpoint-hw
25 set srcfile ${testfile}.c
26 set binfile ${objdir}/${subdir}/${testfile}
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
28 untested "Couldn't compile test program"
29 return -1
30 }
31
32 gdb_exit
33 gdb_start
34 gdb_reinitialize_dir $srcdir/$subdir
35 gdb_load ${binfile}
36
37 # Create the watchpoint before the inferior gets started. Now the native CPU
38 # target is still not active and its `to_can_use_hw_breakpoint' is not
39 # installed, therefore only a software watchpoint gets created.
40
41 gdb_test "watch watchee" "atchpoint 1: watchee"
42
43 # `runto_main' or `runto main' would delete the watchpoint created above.
44
45 if { [gdb_start_cmd] < 0 } {
46 untested start
47 return -1
48 }
49 gdb_test "" "main .* at .*" "start"
50
51 # Check it is really a `hw'-watchpoint.
52 gdb_test "info watchpoints" "1 *hw watchpoint .* watchee"
This page took 0.030511 seconds and 4 git commands to generate.