Hardware watchpoints
Jim Blandy
jimb@cygnus.com
Tue Oct 26 17:04:00 GMT 1999
> > The problem is that nobody ever uses the value returned by the call to
> > evaluate_expression in insert_breakpoints, so it remains lazy. Try
> > this, in addition to my previous change:
> >
> > *** breakpoint.c 1999/10/21 19:16:52 1.254
> > --- breakpoint.c 1999/10/24 19:21:53
> > ***************
> > *** 851,856 ****
> > --- 851,858 ----
> > /* Evaluate the expression and cut the chain of values
> > produced off from the value chain. */
> > v = evaluate_expression (b->exp);
> > + if (VALUE_LAZY (v))
> > + value_fetch_lazy (v);
> > value_release_to_mark (mark);
> >
> > b->val_chain = v;
>
> Thanks, this seems to have done the trick. I tried it with structs,
> pointers to structs, pointers to pointers to structs, and with arrays,
> and it seems to work correctly in all cases.
Great!
> I think it might be a good idea to also check v->lazy when we remove
> watchpoints. What happens now is that GDB tries to remove watchpoints
> it never set in the first place. The DJGPP implementation handles
> this gracefully, but perhaps some other implementation of watchpoints
> could become confused?
Yes --- insert_breakpoints and remove_breakpoint should use exactly
the same critera for generating watchpoints.
> Btw, the above change seems to rely on the assumption that the first
> value on the value chain is always the expression to be watched
> itself. Is this a safe assumption?
Yes. v is the value of the expression. It's perfectly correct to
insist that that one not be lazy --- that's what we're watching for
changes in!
> Thanks again for the guidance.
Jim makes wild suggestions, Eli finds the bugs! Good deal! :)
More information about the Gdb
mailing list