Re: breakpoint for accessing memory location

Daniel Jacobowitz
2006-10-22T17:24:38Z

On Sun, Oct 22, 2006 at 10:20:02AM -0500, Rodney M. Bates wrote:
> If p is local to an inner block, but the compiler did the common thing of
> flattening p and all its cousins into one activation record for the
> containing
> function, does the watchpoint really get deleted when execution leaves the
> block, or when the containing function returns?

When the debug info says it goes out of scope, or more specifically,
when GDB no longer knows where to find it.

> If the expression is *p and p stays in scope, but points to a local variable
> that goes out of scope, does the watch get deleted then?

We have no way of knowing this, nor is it generally desirable (that
could be the very bug you are chasing).

> Presumably, if p points to a heap object that is deallocated, this is too
> hard to detect and the watchpoint remains on the machine address. Since
> "deallocation" is often done by programmer-written allocators that the
> language has no knowledge of, it would be hard to even define what it
> means to deallocate.

Ditto.

--
Daniel Jacobowitz
CodeSourcery