This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Watchpoints with condition
- From: Jim Blandy <jimb at codesourcery dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb at sourceware dot org
- Date: Mon, 03 Dec 2007 15:07:19 -0800
- Subject: Re: Watchpoints with condition
- References: <200711301925.20196.vladimir@codesourcery.com> <uhcj31lko.fsf@gnu.org> <m3eje7ux9u.fsf@codesourcery.com> <20071130234853.GA27583@caradoc.them.org> <m3odd74qam.fsf@codesourcery.com> <uodd7ze86.fsf@gnu.org>
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?