Re: Watchpoints with condition

Jim Blandy
2007-12-03T23:07:31Z

Eli Zaretskii <eliz at gnu.org> writes:
>> I think the only valuable use case for conditional watchpoints is the
>> one you mentioned, where Y is something expensive, and X is some
>> cheaper conservative approximation to the condition we really want.
>
> Well, you are wrong (and Daniel explained one reason why). Believe
> me, this use case is very useful and important. (Actually, it was one
> of the main reasons I got involved with fixing x86 hardware
> watchpoints at the time: I needed to set several watchpoints on the
> same variable, each one watching a different value being written.)

I don't want to believe you; I want to understand it for myself. :)

What I understand Daniel to be saying is that 'watch X if Y' allows
you to restrict yourself to transitions into a certain state, whereas
any 'watch Y' will always report both transitions to and from the
state.

In the use case you mention, why wouldn't 'watch v == X'; 'watch v ==
Y'; etc. have worked for you? You would have gotten more hits than
you'd like, but only twice as many --- is that right?