Allow making GDB not automatically connect to the native target.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watchpoints.exp
index 4779764b3c38b39d212552ab701b33330331a2a8..a09a4f022a38c6280af85d3bc34a8a7ee954abb1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2009-2014 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
 
 # This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
 
-if $tracelevel then {
-    strace $tracelevel
-}
-
 
-set testfile "watchpoints"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 set wp_set 1
 
-if [get_compiler_info ${binfile}] {
+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] {
This page took 0.025641 seconds and 4 git commands to generate.