[RFA] Fix problem with watchpoint test in gdb.base/commands.exp

Fred Fish
2002-05-01T23:48:48Z

This patch fixes the following problem.

57c57
< FAIL: gdb.base/commands.exp: continue with watch
---
> PASS: gdb.base/commands.exp: continue with watch

-Fred

2002-05-01 Fred Fish <fnf@redhat.com>

* gdb.base/commands.exp (watchpoint_command_test): Allow the
watchpoint to go out of scope on either the last line of the
factorial function or the location returned to in the caller.
Add comment describing rationale for this change.

Index: gdb.base/commands.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/commands.exp,v
retrieving revision 1.10
diff -c -p -r1.10 commands.exp
*** gdb.base/commands.exp 13 Dec 2001 22:42:23 -0000 1.10
--- gdb.base/commands.exp 1 May 2002 23:43:56 -0000
*************** proc watchpoint_command_test {} {
*** 330,337 ****
timeout {fail "(timeout) end commands on watch"}
}
send_gdb "continue\n"
gdb_expect {
! -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:57.*$gdb_prompt $" {
pass "continue with watch"
}
-re "$gdb_prompt $" {fail "continue with watch"}
--- 330,345 ----
timeout {fail "(timeout) end commands on watch"}
}
send_gdb "continue\n"
+ # Note that when watchpoints are implemented by software single
+ # stepping the inferior and evaluating the watchpoint at each
+ # step, local_var can go out of scope while we are in the function
+ # epilogue, such as when executing an instruction that restores the
+ # frame pointer to the callee value when local_var is accessed
+ # relative to the frame pointer. Thus the watchpoint may be
+ # deleted while we are still in the block for factorial, in the
+ # code corresponding to the closing brace.
gdb_expect {
! -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*$gdb_prompt $" {
pass "continue with watch"
}
-re "$gdb_prompt $" {fail "continue with watch"}