This is the mail archive of the gdb@sourceware.org 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]
Other format: [Raw text]

RE: RE: -var-update using formatted value


> > However, in my case, where we work with embedded systems and we want to
> > minimize the requests to the (potentially very slow) back-end, I was
> > hoping to share the same variable
> > object and to cache the value of each format.
> > 
> I don't understand the above. Changing format of a variable object is not
> supposed to refetch if from the target, so caching string representation
> on frontend side is not necessary.

I'm not sure what you mean.
If I have a varObject displaying 0x1 in hex and then I want to show the value
in binary, I will need to go to the target.
If I cache both those values in the frontend, then I was hoping to rely
on var-update to let me know if my cache is still valid, for any formats not
just the last one I used.

> >     -var-create - * z   (print value is remembered to be 11)
> >     -var-set-format var1 hex
> >     -var-evaluate-expression var1 => Oxb
> >     -exec-step
> >     -var-update var1              => will show var1 to have changed
> 
> As I've said before, it's a bug -- -var-set-format should recompute the stored
> value. 

This one may not really be a true bug.  The real bug is is not showing a change
when there is one in evaluate-expression.  In this case, it is superfluous...
The code has a comment about var-update being an approximation (in the case
of a double var-assign, where this can also happen):

  /* If the value has changed, record it, so that next -var-update can
     report this change.  If a variable had a value of '1', we've set it
     to '333' and then set again to '1', when -var-update will report this
     variable as changed -- because the first assignment has set the
     'updated' flag.  There's no need to optimize that, because return value
     of -var-update should be considered an approximation.  */
(from varobj.c)


> 1. Make -var-evaluate-expression directly return stored printed value
> 2. Make -var-set-format recompute the stored printed value.

Sounds good.
Although the second change would have an interesting impact; if a front-end 
sends a var-set-format but does not follow it by a var-evaluate-expression.
The front-end would not know about the latest printed value, but var-update
would not show a change from the last var-evaluate-expression (the one of the old
format and that the frontend does know about.)  
But this could be considered a bug in the frontend.



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