old-cross-binutils/gdb/testsuite/gdb.base/watchpoint.exp

931 lines
32 KiB
Text
Raw Normal View History

# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2007, 2008, 2009,
2011-01-01 15:34:07 +00:00
# 2010, 2011 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
# 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 Fred Fish. (fnf@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set testfile "watchpoint"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
1999-06-28 16:06:02 +00:00
set wp_set 1
if [get_compiler_info ${binfile}] {
return -1
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with untested followed by return combination. * gdb.arch/altivec-regs.exp: Likewise. * gdb.arch/e500-abi.exp: Likewise. * gdb.arch/e500-regs.exp: Likewise. * gdb.arch/gdb1291.exp: Likewise. * gdb.arch/gdb1431.exp: Likewise. * gdb.arch/gdb1558.exp: Likewise. * gdb.arch/i386-prologue.exp: Likewise. * gdb.arch/i386-unwind.exp: Likewise. * gdb.asm/asm-source.exp: Likewise. * gdb.base/a2-run.exp: Likewise. * gdb.base/advance.exp: Likewise. * gdb.base/all-bin.exp: Likewise. * gdb.base/annota1.exp: Likewise. * gdb.base/annota3.exp: Likewise. * gdb.base/args.exp: Likewise. * gdb.base/arithmet.exp: Likewise. * gdb.base/assign.exp: Likewise. * gdb.base/async.exp: Likewise. * gdb.base/attach.exp: Likewise. * gdb.base/bang.exp: Likewise. * gdb.base/bigcore.exp: Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/call-strs.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/checkpoint.exp: Likewise. * gdb.base/chng-syms.exp: Likewise. * gdb.base/code-expr.exp: Likewise. * gdb.base/commands.exp: Likewise. * gdb.base/completion.exp: Likewise. * gdb.base/cond-expr.exp: Likewise. * gdb.base/condbreak.exp: Likewise. * gdb.base/consecutive.exp: Likewise. * gdb.base/constvars.exp: Likewise. * gdb.base/corefile.exp: Likewise. * gdb.base/cvexpr.exp: Likewise. * gdb.base/dbx.exp: Likewise. * gdb.base/define.exp: Likewise. * gdb.base/detach.exp: Likewise. * gdb.base/display.exp: Likewise. * gdb.base/dump.exp: Likewise. * gdb.base/ena-dis-br.exp: Likewise. * gdb.base/ending-run.exp: Likewise. * gdb.base/environ.exp: Likewise. * gdb.base/eval-skip.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/fileio.exp: Likewise. * gdb.base/finish.exp: Likewise. * gdb.base/float.exp: Likewise. * gdb.base/foll-exec.exp: Likewise. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/freebpcmd.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/gcore.exp: Likewise. * gdb.base/gdb1090.exp: Likewise. * gdb.base/gdb1250.exp: Likewise. * gdb.base/huge.exp: Likewise. * gdb.base/info-proc.exp: Likewise. * gdb.base/interrupt.exp: Likewise. * gdb.base/jump.exp: Likewise. * gdb.base/langs.exp: Likewise. * gdb.base/lineinc.exp: Likewise. * gdb.base/list.exp: Likewise. * gdb.base/logical.exp: Likewise. * gdb.base/long_long.exp: Likewise. * gdb.base/macscp.exp: Likewise. * gdb.base/maint.exp: Likewise. * gdb.base/mips_pro.exp: Likewise. * gdb.base/miscexprs.exp: Likewise. * gdb.base/multi-forks.exp: Likewise. * gdb.base/opaque.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/pc-fp.exp: Likewise. * gdb.base/pointers.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/psymtab.exp: Likewise. * gdb.base/ptype.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/relational.exp: Likewise. * gdb.base/relocate.exp: Likewise. * gdb.base/remote.exp: Likewise. * gdb.base/reread.exp: Likewise. * gdb.base/restore.exp: Likewise. * gdb.base/return.exp: Likewise. * gdb.base/return2.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sect-cmd.exp: Likewise. * gdb.base/sep.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.base/setvar.exp: Likewise. * gdb.base/sigall.exp: Likewise. * gdb.base/sigbpt.exp: Likewise. * gdb.base/signals.exp: Likewise. * gdb.base/signull.exp: Likewise. * gdb.base/sizeof.exp: Likewise. * gdb.base/solib.exp: Likewise. * gdb.base/step-line.exp: Likewise. * gdb.base/step-test.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/structs2.exp: Likewise. * gdb.base/term.exp: Likewise. * gdb.base/twice.exp: Likewise. * gdb.base/until.exp: Likewise. * gdb.base/varargs.exp: Likewise. * gdb.base/volatile.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.base/whatis-exp.exp: Likewise. * gdb.base/whatis.exp: Likewise. * gdb.cp/ambiguous.exp: Likewise. * gdb.cp/annota2.exp: Likewise. * gdb.cp/annota3.exp: Likewise. * gdb.cp/bool.exp: Likewise. * gdb.cp/breakpoint.exp: Likewise. * gdb.cp/casts.exp: Likewise. * gdb.cp/class2.exp: Likewise. * gdb.cp/classes.exp: Likewise. * gdb.cp/cplusfuncs.exp: Likewise. * gdb.cp/ctti.exp: Likewise. * gdb.cp/derivation.exp: Likewise. * gdb.cp/exception.exp: Likewise. * gdb.cp/gdb1355.exp: Likewise. * gdb.cp/hang.exp: Likewise. * gdb.cp/inherit.exp: Likewise. * gdb.cp/local.exp: Likewise. * gdb.cp/m-data.exp: Likewise. * gdb.cp/m-static.exp: Likewise. * gdb.cp/member-ptr.exp: Likewise. * gdb.cp/method.exp: Likewise. * gdb.cp/misc.exp: Likewise. * gdb.cp/namespace.exp: Likewise. * gdb.cp/overload.exp: Likewise. * gdb.cp/ovldbreak.exp: Likewise. * gdb.cp/pr-1023.exp: Likewise. * gdb.cp/pr-1210.exp: Likewise. * gdb.cp/pr-574.exp: Likewise. * gdb.cp/printmethod.exp: Likewise. * gdb.cp/psmang.exp: Likewise. * gdb.cp/ref-params.exp: Likewise. * gdb.cp/ref-types.exp: Likewise. * gdb.cp/rtti.exp: Likewise. * gdb.cp/templates.exp: Likewise. * gdb.cp/try_catch.exp: Likewise. * gdb.cp/userdef.exp: Likewise. * gdb.cp/virtfunc.exp: Likewise. * gdb.disasm/am33.exp: Likewise. * gdb.disasm/h8300s.exp: Likewise. * gdb.disasm/mn10300.exp: Likewise. * gdb.disasm/sh3.exp: Likewise. * gdb.disasm/t01_mov.exp: Likewise. * gdb.disasm/t02_mova.exp: Likewise. * gdb.disasm/t03_add.exp: Likewise. * gdb.disasm/t04_sub.exp: Likewise. * gdb.disasm/t05_cmp.exp: Likewise. * gdb.disasm/t06_ari2.exp: Likewise. * gdb.disasm/t07_ari3.exp: Likewise. * gdb.disasm/t08_or.exp: Likewise. * gdb.disasm/t09_xor.exp: Likewise. * gdb.disasm/t10_and.exp: Likewise. * gdb.disasm/t11_logs.exp: Likewise. * gdb.disasm/t12_bit.exp: Likewise. * gdb.disasm/t13_otr.exp: Likewise. * gdb.hp/gdb.aCC/optimize.exp: Likewise. * gdb.hp/gdb.aCC/watch-cmd.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.hp/gdb.base-hp/dollar.exp: Likewise. * gdb.hp/gdb.base-hp/hwwatchbus.exp: Likewise. * gdb.hp/gdb.base-hp/pxdb.exp: Likewise. * gdb.hp/gdb.base-hp/reg-pa64.exp: Likewise. * gdb.hp/gdb.base-hp/reg.exp: Likewise. * gdb.hp/gdb.base-hp/sized-enum.exp: Likewise. * gdb.hp/gdb.compat/xdb1.exp: Likewise. * gdb.hp/gdb.compat/xdb3.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg01.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg02.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg03.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg04.exp: Likewise. * gdb.mi/gdb701.exp: Likewise. * gdb.mi/gdb792.exp: Likewise. * gdb.mi/mi-basics.exp: Likewise. * gdb.mi/mi-break.exp: Likewise. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-console.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-eval.exp: Likewise. * gdb.mi/mi-file.exp: Likewise. * gdb.mi/mi-read-memory.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-return.exp: Likewise. * gdb.mi/mi-simplerun.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-stepi.exp: Likewise. * gdb.mi/mi-syn-frame.exp: Likewise. * gdb.mi/mi-until.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-child.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-display.exp: Likewise. * gdb.mi/mi-watch.exp: Likewise. * gdb.mi/mi2-basics.exp: Likewise. * gdb.mi/mi2-break.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-console.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-eval.exp: Likewise. * gdb.mi/mi2-file.exp: Likewise. * gdb.mi/mi2-read-memory.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-return.exp: Likewise. * gdb.mi/mi2-simplerun.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-stepi.exp: Likewise. * gdb.mi/mi2-syn-frame.exp: Likewise. * gdb.mi/mi2-until.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-child.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise. * gdb.mi/mi2-var-display.exp: Likewise. * gdb.mi/mi2-watch.exp: Likewise. * gdb.stabs/exclfwd.exp: Likewise. * gdb.stabs/weird.exp: Likewise. * gdb.threads/gcore-thread.exp: Likewise. * gdb.trace/actions.exp: Likewise. * gdb.trace/backtrace.exp: Likewise. * gdb.trace/circ.exp: Likewise. * gdb.trace/collection.exp: Likewise. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/limits.exp: Likewise. * gdb.trace/packetlen.exp: Likewise. * gdb.trace/passc-dyn.exp: Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/save-trace.exp: Likewise. * gdb.trace/tfind.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/while-dyn.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise.
2006-08-10 05:27:22 +00:00
untested watchpoint.exp
return -1
}
# Prepare for watchpoint tests by setting up two breakpoints and one
# watchpoint.
#
# We use breakpoints at marker functions to get past all the startup code,
# so we can get to the watchpoints in a reasonable amount of time from a
# known starting point.
#
# For simplicity, so we always know how to reference specific breakpoints or
# watchpoints by number, we expect a particular ordering and numbering of
# each in the combined breakpoint/watchpoint table, as follows:
#
# Number What Where
# 1 Breakpoint marker1()
# 2 Breakpoint marker2()
# 3 Watchpoint ival3
proc initialize {} {
global gdb_prompt
global hex
global decimal
global srcfile
1999-06-28 16:06:02 +00:00
global wp_set
# Disable hardware watchpoints if necessary.
if [target_info exists gdb,no_hardware_watchpoints] {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}
if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] {
return 0;
}
if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] {
return 0;
}
if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break in watchpoint.exp" ] {
return 0;
}
1999-06-28 16:06:02 +00:00
# ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
1999-08-02 23:48:37 +00:00
# before running can cause the inferior to croak on HP-UX 11.0 for
# reasons yet unknown, we've disabled the ability to set watches
# without a running inferior. Verify the restriction.
1999-06-28 16:06:02 +00:00
#
send_gdb "watch ival3\n"
gdb_expect {
-re ".*\[Ww\]atchpoint 3: ival3.*$gdb_prompt $" {
pass "set watchpoint on ival3"
}
-re "warning: can't do that without a running program; try \"break main\", \"run\" first.*$gdb_prompt $" {
pass "set watchpoint on ival3"
set wp_set 0
return 1
}
timeout {
fail "(timeout) set watchpoint on ival3"
return 0
}
}
if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
return 0;
}
# After installing the watchpoint, we disable it until we are ready
# to use it. This allows the test program to run at full speed until
# we get to the first marker function.
if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] {
return 0;
}
return 1
}
#
# Test simple watchpoint.
#
proc test_simple_watchpoint {} {
global gdb_prompt
global hex
global decimal
1999-06-28 16:06:02 +00:00
global wp_set
# Ensure that the watchpoint is disabled when we startup.
1999-06-28 16:06:02 +00:00
if { $wp_set } {
if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] {
return 0;
}
}
# Run until we get to the first marker function.
gdb_run_cmd
set timeout 600
gdb_expect {
-re "Breakpoint 1, marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_simple_watchpoint"
}
-re ".*$gdb_prompt $" {
fail "run to marker1 in test_simple_watchpoint"
return
}
timeout {
fail "run to marker1 in test_simple_watchpoint (timeout)"
return
}
}
1999-06-28 16:06:02 +00:00
if { !$wp_set } {
# ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
1999-08-02 23:48:37 +00:00
# before running can cause the inferior to croak on HP-UX 11.0
# for reasons yet unknown, we've disabled the ability to set
1999-06-28 16:06:02 +00:00
# watches without a running inferior. The following testpoints used
# to be in [initialize].
#
gdb_test "watch ival3" \
"\[Ww\]atchpoint 3: ival3" \
"set watchpoint on ival3"
1999-06-28 16:06:02 +00:00
set wp_set 1
gdb_test "info watch" \
"3\[ \]*.*watchpoint.*ival3" \
"watchpoint found in watchpoint/breakpoint table"
1999-06-28 16:06:02 +00:00
# After installing the watchpoint, we disable it until we are ready
# to use it. This allows the test program to run at full speed until
# we get to the first marker function.
gdb_test "disable 3" "disable 3" "disable watchpoint"
1999-06-28 16:06:02 +00:00
}
# After reaching the marker function, enable the watchpoint.
if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] {
return ;
}
gdb_test "break func1" "Breakpoint.*at.*"
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "set \$func1_breakpoint_number = \$bpnum"
gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1.*" \
"continue to breakpoint at func1"
# Continue until the first change, from -1 to 0
send_gdb "cont\n"
gdb_expect {
-re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$gdb_prompt $" {
pass "watchpoint hit, first time"
}
-re "Continuing.*Breakpoint.*func1.*$gdb_prompt $" {
setup_xfail "m68*-*-*" 2597
fail "thought it hit breakpoint at func1 twice"
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "delete \$func1_breakpoint_number"
gdb_test "continue" "\
Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \
"watchpoint hit, first time"
}
-re ".*$gdb_prompt $" { fail "watchpoint hit, first time" ; return }
timeout { fail "watchpoint hit, first time (timeout)" ; return }
eof { fail "watchpoint hit, first time (eof)" ; return }
}
1999-12-07 03:56:43 +00:00
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 1 time.*" "Watchpoint hit count is 1"
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "delete \$func1_breakpoint_number"
# Continue until the next change, 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"
1999-12-07 03:56:43 +00:00
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 2 times.*" "Watchpoint hit count is 2"
# 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"
1999-12-07 03:56:43 +00:00
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "Watchpoint hit count is 3"
# 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"
1999-12-07 03:56:43 +00:00
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 4 times.*" "Watchpoint hit count is 4"
# 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"
1999-12-07 03:56:43 +00:00
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 5 times.*" "Watchpoint hit count is 5"
# Continue until we hit the finishing marker function.
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \
"continue to marker2"
# Disable the watchpoint so we run at full speed until we exit.
if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] {
return ;
}
# Run until process exits.
if [target_info exists gdb,noresults] { return }
1999-04-26 18:34:20 +00:00
gdb_continue_to_end "continue to exit in test_simple_watchpoint"
}
# Test disabling watchpoints.
proc test_disabling_watchpoints {} {
global gdb_prompt
global binfile
global srcfile
global decimal
global hex
1999-06-28 16:06:02 +00:00
# "info watch" is the same as "info break"
gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table"
1999-06-28 16:06:02 +00:00
# Ensure that the watchpoint is disabled when we startup.
if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] {
return 0;
}
# Run until we get to the first marker function.
gdb_run_cmd
set timeout 600
gdb_expect {
-re "Breakpoint 1, marker1 .*$gdb_prompt $" {
pass "run to marker1 in test_disabling_watchpoints"
}
-re ".*$gdb_prompt $" {
fail "run to marker1 in test_disabling_watchpoints"
return
}
timeout {
fail "run to marker1 in test_disabling_watchpoints (timeout)"
return
}
}
# After reaching the marker function, enable the watchpoint.
if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] {
return ;
}
# Continue until the first change, from -1 to 0
# Don't check the old value, because on VxWorks the variable value
# will not have been reinitialized.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time"
# Continue until the next change, from 0 to 1.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time"
# Disable the watchpoint but leave breakpoints
if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] {
return 0;
}
# Check watchpoint list, looking for the entry that confirms the
# watchpoint is disabled.
1999-06-28 16:06:02 +00:00
gdb_test "info watchpoints" "\[0-9]+\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table"
# Continue until we hit the finishing marker function.
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
"disabled watchpoint skipped"
if [target_info exists gdb,noresults] { return }
1999-04-26 18:34:20 +00:00
gdb_continue_to_end "continue to exit in test_disabling_watchpoints"
}
# Test stepping and other mundane operations with watchpoints enabled
proc test_stepping {} {
global gdb_prompt
if [runto marker1] then {
gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2"
# Well, let's not be too mundane. It should be a *bit* of a challenge
gdb_test "break func2 if 0" "Breakpoint.*at.*"
gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*"
1999-06-28 16:06:02 +00:00
gdb_test "p func1 ()" "= 73" \
"calling function with watchpoint enabled"
#
# "finish" brings us back to main.
# On some targets (e.g. alpha) gdb will stop from the finish in midline
# of the marker1 call. This is due to register restoring code on
# the alpha and might be caused by stack adjustment instructions
# on other targets. In this case we will step once more.
#
send_gdb "finish\n"
gdb_expect {
1999-10-12 04:37:53 +00:00
-re "Run.*exit from.*marker1.* at" {
pass "finish from marker1"
}
2000-02-05 07:30:26 +00:00
default { fail "finish from marker1 (timeout)" ; return }
}
gdb_expect {
-re "marker1 \\(\\);.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re "func1 \\(\\);.*$gdb_prompt $" {
2000-02-05 07:30:26 +00:00
pass "back at main from marker1"
}
-re ".*$gdb_prompt $" {
2000-02-05 07:30:26 +00:00
fail "back at main from marker1"
}
2000-02-05 07:30:26 +00:00
default { fail "back at main from marker1 (timeout)" ; return }
}
gdb_test "next" "for \\(count = 0.*" "next to `for' in watchpoint.exp"
# Now test that "until" works. It's a bit tricky to test
# "until", because compilers don't always arrange the code
# exactly the same way, and we might get slightly different
# sequences of statements. But the following should be true
# (if not it is a compiler or a debugger bug): The user who
# does "until" at every statement of a loop should end up
# stepping through the loop once, and the debugger should not
# stop for any of the remaining iterations.
gdb_test "until" "ival1 = count.*" "until to ival1 assignment"
gdb_test "until" "ival3 = count.*" "until to ival3 assignment"
send_gdb "until\n"
gdb_expect {
-re "(for \\(count = 0|\}).*$gdb_prompt $" {
gdb_test "until" "ival1 = count; /. Outside loop ./" \
"until out of loop"
}
-re "ival1 = count; /. Outside loop ./.*$gdb_prompt $" {
pass "until out of loop"
}
-re ".*$gdb_prompt $" {
fail "until out of loop"
}
1999-12-14 01:06:04 +00:00
default { fail "until out of loop (timeout)" ; return }
}
gdb_test "step" "ival2 = count.*" "step to ival2 assignment"
}
}
# Test stepping and other mundane operations with watchpoints enabled
proc test_watchpoint_triggered_in_syscall {} {
global gdb_prompt
# These tests won't work without printf support.
if [gdb_skip_stdio_test "watchpoints triggered in syscall"] {
return;
}
# Run until we get to the first marker function.
set x 0
set y 0
set testname "Watch buffer passed to read syscall"
if [runto marker2] then {
gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]"
gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]"
gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]"
gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]"
gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]"
gdb_test "break marker4" ".*Breakpoint.*"
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "set doread = 1"
# If we send_gdb "123\n" before gdb has switched the tty, then it goes
# to gdb, not the inferior, and we lose. So that is why we have
# watchpoint.c prompt us, so we can wait for that prompt.
send_gdb "continue\n";
gdb_expect {
-re "Continuing\\.\r\ntype stuff for buf now:" {
pass "continue to read"
}
default {
fail "continue to read";
return ;
}
}
send_gdb "123\n"
gdb_expect {
-re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
-re ".*$gdb_prompt $" { pass "sent 123" }
timeout { fail "sent 123 (timeout)" }
}
# Examine the values in buf to see how many watchpoints we
# should have printed.
send_gdb "print buf\[0\]\n"
gdb_expect {
-re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[0\]"}
-re ".*= 0.*$gdb_prompt $" { pass "print buf\[0\]"}
-re ".*$gdb_prompt $" { fail "print buf\[0\]"}
default { fail "print buf\[0\]"}
}
send_gdb "print buf\[1\]\n"
gdb_expect {
-re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[1\]"}
-re ".*= 0.*$gdb_prompt $" { pass "print buf\[1\]"}
-re ".*$gdb_prompt $" { fail "print buf\[1\]"}
default { fail "print buf\[1\]"}
}
send_gdb "print buf\[2\]\n"
gdb_expect {
-re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[2\]"}
-re ".*= 0.*$gdb_prompt $" { pass "print buf\[2\]"}
-re ".*$gdb_prompt $" { fail "print buf\[2\]"}
default { fail "print buf\[2\]"}
}
send_gdb "print buf\[3\]\n"
gdb_expect {
-re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[3\]"}
-re ".*= 0.*$gdb_prompt $" { pass "print buf\[3\]"}
-re ".*$gdb_prompt $" { fail "print buf\[3\]" }
default { fail "print buf\[3\]" }
}
# Did we find what we were looking for? If not, flunk it.
if [expr $x==$y] then { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
# Continue until we hit the finishing marker function.
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker4 \\(\\).*" \
"continue to marker4"
# Disable everything so we can finish the program at full speed
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "disable" "disable in test_watchpoint_triggered_in_syscall"
if [target_info exists gdb,noresults] { return }
1999-04-26 18:34:20 +00:00
gdb_continue_to_end "continue to exit in test_watchpoint_triggered_in_syscall"
}
}
# Do a simple test of of watching through a pointer when the pointer
# itself changes. Should add some more complicated stuff here.
proc test_complex_watchpoint {} {
global gdb_prompt
if [runto marker4] then {
gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
gdb_test "break marker5" ".*Breakpoint.*"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ptr1->val.*Old value = 1.*New value = 2.*" "Test complex watchpoint"
# Continue until we hit the marker5 function.
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \
"did not trigger wrong watchpoint"
1999-06-28 16:06:02 +00:00
# Test watches of things declared locally in a function.
# In particular, test that a watch of stack-based things
# is deleted when the stack-based things go out of scope.
#
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "disable" "disable in test_complex_watchpoint"
1999-06-28 16:06:02 +00:00
gdb_test "break marker6" ".*Breakpoint.*"
gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \
"continue to marker6"
gdb_test "break func2" ".*Breakpoint.*"
gdb_test "cont" "Continuing.*func2.*"
# Test a watch of a single stack-based variable, whose scope
# is the function we're now in. This should auto-delete when
# execution exits the scope of the watchpoint.
#
gdb_test "watch local_a" ".*\[Ww\]atchpoint \[0-9\]*: local_a" "set local watch"
gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch"
gdb_test "cont" "Continuing.*func2.*"
# We should be in "func2" again now. Test a watch of an
# expression which includes both a stack-based local and
# something whose scope is larger than this invocation
# of "func2". This should also auto-delete.
#
gdb_test "watch local_a + ival5" ".*\[Ww\]atchpoint \[0-9\]*: local_a . ival5" \
"set partially local watch"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \
"trigger1 partially local watch"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \
"trigger2 partially local watch"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \
"self-delete partially local watch"
# We should be in "func2" again now. Test a watch of a
# static (non-stack-based) local. Since this has scope
# across any invocations of "func2", it should not auto-
# delete.
#
gdb_test "cont" "Continuing.*func2.*"
gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \
"set static local watch"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \
"trigger static local watch"
gdb_test "cont" "Continuing.*marker6 \\(\\).*" \
"continue after trigger static local watch"
gdb_test "info break" ".*watchpoint.*static_b.*" \
"static local watch did not self-delete"
# We should be in "recurser" now. Test a watch of a stack-
# based local. Symbols mentioned in a watchpoint are bound
# at watchpoint-creation. Thus, a watch of a stack-based
# local to a recursing function should be bound only to that
# one invocation, and should not trigger for other invocations.
#
gdb_test "tbreak recurser" ".*breakpoint.*"
1999-06-28 16:06:02 +00:00
gdb_test "cont" "Continuing.*recurser.*"
gdb_test "watch local_x" ".*\[Ww\]atchpoint \[0-9\]*: local_x" \
"set local watch in recursive call"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_x.*New value = 2.*" \
"trigger local watch in recursive call"
gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \
"self-delete local watch in recursive call"
# Disable everything so we can finish the program at full speed
2010-06-01 Michael Snyder <msnyder@vmware.com> * gdb.base/arithmet.exp: Use gdb_test_no_output. * gdb.base/arrayidx.exp: Ditto. * gdb.base/attach.exp: Ditto. * gdb.base/auxv.exp: Ditto. * gdb.base/bigcre.exp: Ditto. * gdb.base/break-always.exp: Ditto. * gdb.base/break-interp.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/breakpoint-shadow.exp: Ditto. * gdb.base/call-ar-st.exp: Ditto. * gdb.base/call-sc.exp: Ditto. * gdb.base/call-signal-resume.exp: Ditto. * gdb.base/callfuncs.exp: Ditto. * gdb.base/catch-syscall.exp: Ditto. * gdb.base/charset.exp: Ditto. * gdb.base/code-expr.exp: Ditto. * gdb.base/commands.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/cursal.exp: Ditto. * gdb.base/cvexpr.exp: Ditto. * gdb.base/default.exp: Ditto. * gdb.base/del.exp: Ditto. * gdb.base/detach.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/foll-fork.exp: Ditto. * gdb.base/foll-vfork.exp: Ditto. * gdb.base/frame-args.exp: Ditto. * gdb.base/funcargs.exp: Ditto. * gdb.base/gcore-buffer-overflow.exp: Ditto. * gdb.base/gdbvars.exp: Ditto. * gdb.base/help.exp: Ditto. * gdb.base/ifelse.exp: Ditto. * gdb.base/included.exp: Ditto. * gdb.base/list.exp: Ditto. * gdb.base/macscp.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/multi-fork.exp: Ditto. * gdb.base/overlays.exp: Ditto. * gdb.base/page.exp: Ditto. * gdb.base/pending.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/pr11022.exp: Ditto. * gdb.base/prelink.exp: Ditto. * gdb.base/printcmds.exp: Ditto. * gdb.base/psymtab.exp: Ditto. * gdb.base/randomize.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/relocate.exp: Ditto. * gdb.base/remote.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/set-lang-auto.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/setvar.exp: Ditto. * gdb.base/signals.exp: Ditto. * gdb.base/signull.exp: Ditto. * gdb.base/sigstep.exp: Ditto. * gdb.base/sizeof.exp: Ditto. * gdb.base/solib-disc.exp: Ditto. * gdb.base/store.exp: Ditto. * gdb.base/structs.exp: Ditto. * gdb.base/structs2.exp: Ditto. * gdb.base/subst.exp: Ditto. * gdb.base/term.exp: Ditto. * gdb.base/trace-commands.exp: Ditto. * gdb.base/unwindonsignal.exp: Ditto. * gdb.base/valgrind-db-attach.exp: Ditto. * gdb.base/varargs.exp: Ditto. * gdb.base/watch-cond.exp: Ditto. * gdb.base/watch_thread_num.exp: Ditto. * gdb.base/watchpoint-cond-gone.exp: Ditto. * gdb.base/watchpoint.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto.
2010-06-01 21:29:21 +00:00
gdb_test_no_output "disable" "disable in test_complex_watchpoint"
if [target_info exists gdb,noresults] { return }
1999-06-28 16:06:02 +00:00
gdb_continue_to_end "continue to exit in test_complex_watchpoint"
}
}
proc test_watchpoint_and_breakpoint {} {
global gdb_prompt
# This is a test for PR gdb/38, which involves setting a
# watchpoint right after you've reached a breakpoint.
if [runto func3] then {
gdb_breakpoint [gdb_get_line_number "second x assignment"]
gdb_continue_to_breakpoint "second x assignment"
gdb_test "watch x" ".*atchpoint \[0-9\]+: x"
gdb_test_multiple "next" "next after watch x" {
-re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
pass "next after watch x"
}
-re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" {
kfail "gdb/38" "next after watch x"
}
}
gdb_test_no_output "delete \$bpnum" "delete watch x"
}
}
proc test_constant_watchpoint {} {
gdb_test "watch 5" "Cannot watch constant value `5'." "number is constant"
gdb_test "watch marker1" "Cannot watch constant value `marker1'." \
"marker1 is constant"
gdb_test "watch count + 6" ".*atchpoint \[0-9\]+: count \\+ 6"
gdb_test_no_output "delete \$bpnum" "delete watchpoint `count + 6'"
gdb_test "watch 7 + count" ".*atchpoint \[0-9\]+: 7 \\+ count"
gdb_test_no_output "delete \$bpnum" "delete watchpoint `7 + count'"
}
proc test_disable_enable_software_watchpoint {} {
# This is regression test for a bug that caused `enable' to fail
# for software watchpoints.
# Watch something not memory to force a software watchpoint.
gdb_test {watch $pc} ".*atchpoint \[0-9\]+: .pc"
gdb_test_no_output "disable \$bpnum" "disable watchpoint `\$pc'"
gdb_test_no_output "enable \$bpnum" "reenable watchpoint `\$pc'"
gdb_test "info watchpoint \$bpnum" \
".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+.pc.*" \
"watchpoint `\$pc' is enabled"
gdb_test_no_output "delete \$bpnum" "delete watchpoint `\$pc'"
}
proc test_watch_location {} {
gdb_breakpoint [gdb_get_line_number "func5 breakpoint here"]
gdb_continue_to_breakpoint "func5 breakpoint here"
gdb_test "watch -location *x" "atchpoint .*: .*" "watch -location .x"
gdb_test "continue" \
"Continuing.*\[Ww\]atchpoint .*: .*New value = 27.*" \
"continue with watch -location"
gdb_test_no_output "delete \$bpnum" "delete watch -location"
}
proc test_inaccessible_watchpoint {} {
global gdb_prompt
# This is a test for watchpoints on currently inaccessible (but later
# valid) memory.
if [runto func4] then {
# Make sure we only allow memory access errors.
set msg "watchpoint refused to insert on nonexistent struct member"
gdb_test_multiple "watch struct1.nosuchmember" $msg {
-re ".*atchpoint \[0-9\]+: struct1.nosuchmember.*$gdb_prompt $" {
# PR breakpoints/9681
fail $msg
}
-re "There is no member named nosuchmember\\..*$gdb_prompt $" {
pass $msg
}
}
# See whether a watchpoint on a normal variable is a hardware
# watchpoint or not. The watchpoints on NULL should be hardware
# iff this one is.
set watchpoint_msg "Watchpoint"
gdb_test_multiple "watch global_ptr" "watch global_ptr" {
-re "Watchpoint \[0-9\]+: global_ptr\r\n.*$gdb_prompt $" {
pass "watch global_ptr"
}
-re "Hardware watchpoint \[0-9\]+: global_ptr\r\n.*$gdb_prompt $" {
set watchpoint_msg "Hardware watchpoint"
pass "watch global_ptr"
}
}
delete_breakpoints
# Make sure that we can watch a constant address, and correctly
# use a HW watchpoint if supported.
gdb_test "watch *(int *) 0" \
"$watchpoint_msg \[0-9\]+: \\*\\(int \\*\\) 0"
delete_breakpoints
# The same, but using -location through an indirection.
gdb_test "watch -location *global_ptr" \
"$watchpoint_msg \[0-9\]+: \-location \\*global_ptr"
delete_breakpoints
# This step requires two HW watchpoints. Since some platforms only
# have a single one, accept either SW or HW watchpoint in this case.
if {[skip_hw_watchpoint_multi_tests]} {
set watchpoint_msg "(Watchpoint|Hardware watchpoint)"
}
gdb_test "watch *global_ptr" "$watchpoint_msg \[0-9\]+: \\\*global_ptr"
gdb_test "set \$global_ptr_breakpoint_number = \$bpnum" ""
gdb_test "next" ".*global_ptr = buf.*" "global_ptr next"
gdb_test_multiple "next" "next over ptr init" {
-re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = .*\r\nNew value = 3 .*\r\n.*$gdb_prompt $" {
# We can not test for <unknown> here because NULL may be readable.
# This test does rely on *NULL != 3.
pass "next over ptr init"
}
}
gdb_test_multiple "next" "next over buffer set" {
-re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = 3 .*\r\nNew value = 7 .*\r\n.*$gdb_prompt $" {
pass "next over buffer set"
}
}
gdb_test "delete \$global_ptr_breakpoint_number" ""
gdb_test "watch **global_ptr_ptr" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr"
gdb_test "set \$global_ptr_ptr_breakpoint_number = \$bpnum" ""
gdb_test "next" ".*global_ptr_ptr = &global_ptr.*" "gloabl_ptr_ptr next"
gdb_test "next" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\[\r\n\]+Old value = .*\r\nNew value = 7 .*" "next over global_ptr_ptr init"
gdb_test "next" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\[\r\n\]+Old value = 7 .*\r\nNew value = 9 .*" "next over global_ptr_ptr buffer set"
gdb_test "next" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\[\r\n\]+Old value = 9 .*\r\nNew value = 5 .*" "next over global_ptr_ptr pointer advance"
gdb_test_no_output "delete \$global_ptr_ptr_breakpoint_number"
}
}
proc test_watchpoint_in_big_blob {} {
global gdb_prompt
gdb_test "watch buf" ".*atchpoint \[0-9\]+: buf"
gdb_test "cont" "Continuing.*atchpoint \[0-9\]+: buf\r\n\r\nOld value = .*testte\".*" "watchpoint on buf hit"
gdb_test_no_output "delete \$bpnum" "delete watch buf"
}
# Start with a fresh gdb.
1999-06-28 16:06:02 +00:00
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
set prev_timeout $timeout
set timeout 600
verbose "Timeout now 600 sec.\n"
if [initialize] then {
test_simple_watchpoint
# The IDT/sim monitor only has 8 (!) open files, of which it uses
# 4 (!). So we have to make sure one program exits before
# starting another one.
if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
initialize
}
test_disabling_watchpoints
# See above.
if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
initialize
}
if ![target_info exists gdb,cannot_call_functions] {
test_stepping
# See above.
if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
initialize
}
}
# Only enabled for some targets merely because it has not been tested
# elsewhere.
# On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
# breakpoint before stopping for the watchpoint. I don't know why.
if {[istarget "hppa*-*-*"]} then {
test_watchpoint_triggered_in_syscall
}
# See above.
if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
initialize
}
# Only enabled for some targets merely because it has not been tested
# elsewhere.
if {[istarget "hppa*-*-*"] || \
[istarget "sparc*-*-sunos*"] || \
[istarget "m32r-*-*"]} then {
test_complex_watchpoint
}
1999-06-28 16:06:02 +00:00
test_inaccessible_watchpoint
1999-06-28 16:06:02 +00:00
# Verify that a user can force GDB to use "slow" watchpoints.
# (This proves rather little on kernels that don't support
# fast watchpoints, but still...)
#
if ![runto_main] then { fail "watch tests suppressed" }
send_gdb "set can-use-hw-watchpoints 0\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "disable fast watches"}
timeout {fail "(timeout) disable fast watches"}
}
send_gdb "show can-use-hw-watchpoints\n"
gdb_expect {
-re "Debugger's willingness to use watchpoint hardware is 0.*$gdb_prompt $"\
{pass "show disable fast watches"}
-re "$gdb_prompt $"\
{fail "show disable fast watches"}
timeout {fail "(timeout) show disable fast watches"}
}
send_gdb "watch ival3 if count > 1\n"
gdb_expect {
-re "Watchpoint \[0-9\]*: ival3.*$gdb_prompt $"\
{pass "set slow conditional watch"}
-re "$gdb_prompt $"\
{fail "set slow conditional watch"}
timeout {fail "(timeout) set slow conditional watch"}
}
send_gdb "continue\n"
gdb_expect {
-re "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*$gdb_prompt $"\
{pass "trigger slow conditional watch"}
-re "$gdb_prompt $"\
{fail "trigger slow conditional watch"}
timeout {fail "(timeout) trigger slow conditional watch"}
}
# We've explicitly disabled hardware watches. Verify that GDB
# refrains from using them.
1999-06-28 16:06:02 +00:00
#
send_gdb "rwatch ival3\n"
gdb_expect {
-re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $"\
{pass "rwatch disallowed when can-set-hw-watchpoints cleared"}
-re "$gdb_prompt $"\
{fail "rwatch disallowed when can-set-hw-watchpoints cleared"}
timeout {fail "(timeout) rwatch disallowed when can-use-hw-watchpoints cleared"}
}
# Read- and access watchpoints are unsupported on HP-UX. Verify
# that GDB gracefully responds to requests to create them.
#
if [istarget "hppa*-*-hpux*"] then {
send_gdb "set can-use-hw-watchpoints 1\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "enable fast watches"}
timeout {fail "(timeout) enable fast watches"}
}
send_gdb "rwatch ival3\n"
gdb_expect {
-re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\
{pass "read watches disallowed"}
-re "$gdb_prompt $"\
{fail "read watches disallowed"}
timeout {fail "(timeout) read watches disallowed"}
}
send_gdb "awatch ival3\n"
gdb_expect {
-re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\
{pass "access watches disallowed"}
-re "$gdb_prompt $"\
{fail "access watches disallowed"}
timeout {fail "(timeout) access watches disallowed"}
}
}
# See above.
if [istarget "mips-idt-*"] then {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
initialize
}
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
# See above.
if [istarget "mips-idt-*"] then {
clean_restart
}
test_constant_watchpoint
test_disable_enable_software_watchpoint
test_watch_location
}
# Restore old timeout
set timeout $prev_timeout
verbose "Timeout now $timeout sec.\n"