Re: [rfc] Allow watchpoints on inaccessible memory

Daniel Jacobowitz
2007-08-21T23:17:07Z

On Tue, Aug 21, 2007 at 03:49:06PM -0700, Jim Blandy wrote:
> This change could be generalized, although I'm not sure it's worth it.
> In evaluating an expression like p->q->r->s, if p->q is an invalid
> address, we could set a hardware watchpoint on p->q. In other words,
> watching the values produced by a failing expression up to the point
> of failure would allow us to use hardware watchpoints whenever
> possible. As it stands, your patch will record NULL as that
> watchpoint's value, and single-step to watch for changes.

No, that's not true. It will find the memory references that
were un-lazied and wait for their values to change. In your example
that will be p and p->q but the value will be NULL because evaluation
didn't finish.

> A lot of this rationale was not obvious to me by a long shot; I spent
> about an hour working it all out. I think the patch needs more
> comments. If you'd like me to write them, just say the word; I like
> writing docs.

I don't understand what subtleties you've found, to be honest. The
approach is a simple extension of what was already there; I think
you're inventing some of the complexity :-) You're welcome to add
comments if you prefer though.

--
Daniel Jacobowitz
CodeSourcery