aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/watchpoint.exp
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2010-06-16 18:30:34 +0000
committerSergio Durigan Junior <sergiodj@redhat.com>2010-06-16 18:30:34 +0000
commit65d79d4b97a28b720c44e26571170a3af5d300f6 (patch)
treeb77afb71ac6b18133c28dfe87c7820bf7ddb3420 /gdb/testsuite/gdb.base/watchpoint.exp
parent3e23530232f272b7a55c6492948bdd76f65e7334 (diff)
downloadgdb-65d79d4b97a28b720c44e26571170a3af5d300f6.zip
gdb-65d79d4b97a28b720c44e26571170a3af5d300f6.tar.gz
gdb-65d79d4b97a28b720c44e26571170a3af5d300f6.tar.bz2
gdb/ChangeLog:
2010-06-16 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * breakpoint.c: Include parser-defs.h. (watchpoint_exp_is_const): New function. (watch_command_1): Call watchpoint_exp_is_const to check if the expression is constant. gdb/doc/ChangeLog: 2010-06-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo: Include information about the correct use of addresses in the `watch' command. gdb/testsuite/ChangeLog: 2010-06-16 Jan Kratochvil <jan.kratochvil@redhat.com> Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/watch-notconst.c: New file. * gdb.base/watch-notconst.S: New file. * gdb.base/watch-notconst2.c: New file. * gdb.base/watch-notconst2.S: New file. * gdb.base/watch-notconst.exp: New file. * gdb.base/watchpoint.c (global_ptr_ptr): New variable. (func4): Add operations on `global_ptr_ptr'. * gdb.base/watchpoint.exp (test_constant_watchpoint): New routine to test watchpoints created with a constant expression. (test_inaccessible_watchpoint): Include tests for watchpoints created with a constant expression.
Diffstat (limited to 'gdb/testsuite/gdb.base/watchpoint.exp')
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp30
1 files changed, 28 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 56d82e4..6029b5b 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -617,7 +617,17 @@ proc test_watchpoint_and_breakpoint {} {
}
}
}
-
+
+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_inaccessible_watchpoint {} {
global gdb_prompt
@@ -638,7 +648,8 @@ proc test_inaccessible_watchpoint {} {
}
gdb_test "watch *global_ptr" ".*atchpoint \[0-9\]+: \\*global_ptr"
- gdb_test "next" ".*global_ptr = buf.*"
+ 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.
@@ -651,6 +662,14 @@ proc test_inaccessible_watchpoint {} {
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"
}
}
@@ -827,6 +846,13 @@ if [initialize] then {
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
+
+ # See above.
+ if [istarget "mips-idt-*"] then {
+ clean_restart
+ }
+
+ test_constant_watchpoint
}
# Restore old timeout