This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Fix problem with watchpoint test in gdb.base/commands.exp
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: fnf at redhat dot com, msnyder at redhat dot com,gdb-patches at sources dot redhat dot com
- Date: Thu, 02 May 2002 11:43:10 -0400
- Subject: Re: [RFA] Fix problem with watchpoint test in gdb.base/commands.exp
- References: <200205021534.g42FYPq19248@duracef.shout.net>
> gdb.texinfo says:
>
> @value{GDBN} automatically deletes watchpoints that watch local
> (automatic) variables, or expressions that involve such variables, when
> they go out of scope, that is, when the execution leaves the block in
> which these variables were defined.
>
> I interpret "go out of scope" to be talking about stack frames,
> but it's likely that gdb can have bugs where it's checking for scope
> by looking at line numbers.
FYI, out of scope includes:
foo ()
{
int bar;
....
{
int bar;
.... <watch bar>
}
}
so there may not necessarily be a frame change. However, if the frame
has gone (or is being destroyed) the variable is out of scope.
> So actually I think that the right result for this use case is
> UNRESOLVED, which means that a human has to look at it each time.
>
> So I don't recommend this patch as is.
>
> How about this: enhance watchpoint_command_test to be two tests,
> one non-recursive, and one recursive. Then the non-recursive one
> will be simple non-controversial and it can PASS on either the last
> line of the callee or the next line of the caller. The recursive
> one will be trickier, it will have to look at the value of some
> recursion variable to make sure that it is in the correct scope.
>
> Michael C
Andrew