Index: gdb/testsuite/gdb.base/watchpoints.exp |
diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp |
index 57500b0519440b1a9724ce1f6157e4ea3fa65bb4..4e21d14c7a59bbb1803215e95c1e73c94ffba3f3 100644 |
--- a/gdb/testsuite/gdb.base/watchpoints.exp |
+++ b/gdb/testsuite/gdb.base/watchpoints.exp |
@@ -1,4 +1,4 @@ |
-# Copyright 2009-2012 Free Software Foundation, Inc. |
+# Copyright 2009-2013 Free Software Foundation, Inc. |
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
@@ -16,9 +16,7 @@ |
# This file was written by Pierre Muller. (muller@ics.u-strasbg.fr) |
-set testfile "watchpoints" |
-set srcfile ${testfile}.c |
-set binfile ${objdir}/${subdir}/${testfile} |
+standard_testfile |
set wp_set 1 |
@@ -26,17 +24,33 @@ if [get_compiler_info] { |
return -1 |
} |
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
- untested watchpoint.exp |
- return -1 |
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
+ untested $testfile.exp |
+ return -1 |
} |
-# Start with a fresh gdb. |
+with_test_prefix "before inferior start" { |
+ # Ensure that if we turn off hardware watchpoints and set a watch point |
+ # before starting the inferior the watchpoint created will not be a |
+ # hardware watchpoint. |
+ gdb_test_no_output "set can-use-hw-watchpoints 0" "" |
+ gdb_test "watch ival1" "Watchpoint \[0-9\]+: ival1" \ |
+ "create watchpoint" |
+ |
+ # The next tests are written to match the current state of gdb: access |
+ # and read watchpoints require hardware watchpoint support, with this |
+ # turned off these can't be created. |
+ gdb_test "awatch ival1" \ |
+ "Can't set read/access watchpoint when hardware watchpoints are disabled." \ |
+ "create access watchpoint" |
+ gdb_test "rwatch ival1" \ |
+ "Can't set read/access watchpoint when hardware watchpoints are disabled." \ |
+ "create read watchpoint" |
+} |
-gdb_exit |
-gdb_start |
-gdb_reinitialize_dir $srcdir/$subdir |
-gdb_load $binfile |
+ # This will turn hardware watchpoints back on and delete the watchpoint |
+ # we just created. |
+ clean_restart ${binfile} |
# Disable hardware watchpoints if necessary. |
if [target_info exists gdb,no_hardware_watchpoints] { |