# This testcase is part of GDB, the GNU debugger.
-# Copyright 2009, 2010 Free Software Foundation, Inc.
+# Copyright 2009-2015 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
set NR_THREADS 4
set X_INCR_COUNT 10
-if $tracelevel {
- strace $tracelevel
-}
-
# This test verifies that a watchpoint is detected in the proper thread
# so the test is only meaningful on a system with hardware watchpoints.
-if [target_info exists gdb,no_hardware_watchpoints] {
- return 0;
+if {[skip_hw_watchpoint_tests]} {
+ return 0
}
-set testfile "watchthreads2"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS -DX_INCR_COUNT=$X_INCR_COUNT"]] != "" } {
+standard_testfile
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS -DX_INCR_COUNT=$X_INCR_COUNT"]] != "" } {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
-gdb_test "set can-use-hw-watchpoints 1" "" ""
+gdb_test_no_output "set can-use-hw-watchpoints 1" ""
#
# Run to `main' where we begin our tests.
gdb_test "watch x" "Hardware watchpoint 3: x"
# Now that the watchpoint is set, we can let the threads increment X.
-gdb_test "set var test_ready = 1" ""
+gdb_test_no_output "set var test_ready = 1"
# While debugging.
-#gdb_test "set debug infrun 1" ""
+#gdb_test_no_output "set debug infrun 1"
set x_inc_line [gdb_get_line_number "X increment"]
set x_thread_loc "thread_function \\\(arg=.*\\\) at .*watchthreads.c:$x_inc_line"