This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: breakpoint for accessing memory location
> Date: Sat, 21 Oct 2006 13:55:25 -0500
> From: "Rodney M. Bates" <rodney.bates@wichita.edu>
> CC: gdb@sourceware.org
>
> What if I put a watch on p->f where there is a visible p, then execution
> goes somewhere where p is not visible, but p still exists? For example,
> suppose p is local to function foo, and foo calls non-nested function bar.
This doesn't qualify as going out of scope, because p is still on the
stack. Only when the function where p is declared returns, will p go
out of scope and the watchpoint be deleted.
> Or, I haven't placed the watch yet and first stop execution in bar. Can
> I now place this watch after moving up the stack to foo's frame?
Yes, because p is in scope in any function called from foo.