This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hardware watchpoints



> 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.

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?

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?

Thanks again for the guidance.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]