This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Fred Fish wrote:
> 
> This patch fixes the following problem.
> 
>   57c57
>   < FAIL: gdb.base/commands.exp: continue with watch
>   ---
>   > PASS: gdb.base/commands.exp: continue with watch
> 
> -Fred

I think this is a good idea (hmm... didn't somebody else recently 
submit this same change, with a different implementation?)
I get bitten by this testsuite glitch all the time.
My only concern is, can this cause us to miss an actual bug?
Such as if this (watchpoint out of scope event) were to trigger
in, say, the wrong frame of the recursive call?


> 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"}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]