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



> Thanks for the explanations.

(I hope I wasn't explaining stuff you already knew!! :) )

> An abridged script of a GDB session follows.  As you see, I watched
> two different members of a struct variable `foo_var': `foo_var.iv' and
> `foo_var.jv'.  GDB produced two value chains, each one including the
> struct member and the struct itself--all of them marked as lazy.

Ahh!  I think I know the problem.

> Perhaps we could use v->type.code in the decision whether to watch any
> values but the first one on the value chain?

I don't think that's quite right.

> One question that I still can't figure out is why does GDB at all
> _need_ to have the parent struct on the value chain?  Where is that
> information used?

GDB doesn't *need* it, per se.  It's just that, as evaluate_expression
runs, as it walks the expression, each operator, variable, constant,
etc. produces a struct value, holding the value of that subexpression.
I think, before watchpoints were implemented, the only reason GDB ever
chained them together was so it could free them before reading the
next user command.  Whoever implemented watchpoints noticed that the
value chain also happened to form a list of the objects touched by an
expression, and thus a list of things which might need to be watched.

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;

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