2016-01-01 05:33:14 +01:00
|
|
|
# Copyright 2009-2016 Free Software Foundation, Inc.
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
|
|
|
|
|
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
standard_testfile
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
set wp_set 1
|
|
|
|
|
2012-06-21 22:46:25 +02:00
|
|
|
if [get_compiler_info] {
|
2009-09-26 14:08:31 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
|
|
|
|
untested $testfile.exp
|
|
|
|
return -1
|
2009-09-26 14:08:31 +02:00
|
|
|
}
|
|
|
|
|
2013-10-18 18:25:14 +02:00
|
|
|
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" \
|
2013-10-29 17:33:42 +01:00
|
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
2013-10-18 18:25:14 +02:00
|
|
|
"create access watchpoint"
|
|
|
|
gdb_test "rwatch ival1" \
|
2013-10-29 17:33:42 +01:00
|
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
2013-10-18 18:25:14 +02:00
|
|
|
"create read watchpoint"
|
|
|
|
}
|
|
|
|
|
|
|
|
# This will turn hardware watchpoints back on and delete the watchpoint
|
|
|
|
# we just created.
|
|
|
|
clean_restart ${binfile}
|
|
|
|
|
2009-09-29 15:02:58 +02:00
|
|
|
# Disable hardware watchpoints if necessary.
|
|
|
|
if [target_info exists gdb,no_hardware_watchpoints] {
|
2010-06-04 01:54:18 +02:00
|
|
|
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
|
2009-09-29 15:02:58 +02:00
|
|
|
}
|
|
|
|
|
2009-09-26 14:08:31 +02:00
|
|
|
runto_main
|
2010-06-09 00:58:03 +02:00
|
|
|
gdb_test "watch ival1" ".*" ""
|
|
|
|
gdb_test "watch ival3" ".*" ""
|
2009-09-26 14:08:31 +02:00
|
|
|
|
* gdb.base/call-strs.exp, gdb.base/default.exp,
gdb.base/ending-run.exp, gdb.base/finish.exp, gdb.base/funcargs.exp,
gdb.base/huge.exp, gdb.base/nodebug.exp, gdb.base/ptype.exp,
gdb.base/restore.exp, gdb.base/return.exp, gdb.base/setvar.exp,
gdb.base/watchpoints.exp, gdb.threads/gcore-thread.exp,
gdb.base/watchpoint-solib.exp: Save and restore timeout.
* gdb.base/ending-run.exp: Correct restore of timeout.
* gdb.base/page.exp: Remove unnecessary timeout setting.
2010-01-29 16:38:38 +01:00
|
|
|
set prev_timeout $timeout
|
2009-09-26 14:08:31 +02:00
|
|
|
set timeout 600
|
|
|
|
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = -1.*New value = 0.*ival1 = count; ival2 = count;.*" "watchpoint hit, first time"
|
|
|
|
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit, first time"
|
|
|
|
|
|
|
|
# Check that the ival3 hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 1 time.*" "watchpoint hit count is 1"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change for ival1, from 0 to 1.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 0.*New value = 1.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, second time"
|
|
|
|
|
|
|
|
# Check that the hit count for ival1 is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 2 times.*" "watchpoint ival1 hit count is 2"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change for ival3, from 0 to 1.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time"
|
|
|
|
|
|
|
|
# Check that the hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 2 times.*" "watchpoint hit count is 2"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change, from 1 to 2.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 1.*New value = 2.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, third time"
|
|
|
|
|
|
|
|
# Check that the hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint ival1 hit count is 3"
|
2009-09-26 14:08:31 +02:00
|
|
|
# Disable ival1 watchpoint
|
2010-06-04 01:54:18 +02:00
|
|
|
gdb_test_no_output "disable 2" ""
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change, from 1 to 2.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
|
|
|
|
|
|
|
|
# Check that the hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change, from 2 to 3.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
|
|
|
|
|
|
|
|
# Check that the hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 4 times.*" "watchpoint hit count is 4"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
|
|
|
# Continue until the next change, from 3 to 4.
|
|
|
|
# Note that this one is outside the loop.
|
|
|
|
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time"
|
|
|
|
|
|
|
|
# Check that the hit count is reported correctly
|
2016-12-01 21:41:23 +01:00
|
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 5 times.*" "watchpoint hit count is 5"
|
2009-09-26 14:08:31 +02:00
|
|
|
|
* gdb.base/call-strs.exp, gdb.base/default.exp,
gdb.base/ending-run.exp, gdb.base/finish.exp, gdb.base/funcargs.exp,
gdb.base/huge.exp, gdb.base/nodebug.exp, gdb.base/ptype.exp,
gdb.base/restore.exp, gdb.base/return.exp, gdb.base/setvar.exp,
gdb.base/watchpoints.exp, gdb.threads/gcore-thread.exp,
gdb.base/watchpoint-solib.exp: Save and restore timeout.
* gdb.base/ending-run.exp: Correct restore of timeout.
* gdb.base/page.exp: Remove unnecessary timeout setting.
2010-01-29 16:38:38 +01:00
|
|
|
set timeout $prev_timeout
|