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: -var-update using formatted value


Answering two mails:

Vladimir wrote:

> 1. Generally, it's best to run gdb on the same system where you run IDE,
> and have it talk to remote stub on the target system. 

You make a good point.
I had started to blur the concept of GDB and target and I didn't pay
attention to this anymore.  Thanks for reminding me.

> 2. Even if you run gdb on target, changing varobj format is very fast,
> so I'm not sure caching formats is an important thing to do. Did you
> actually run into a case where the performance of changing format is
> unacceptable?

No actual measurements.
However, and I'm sorry for not letting this go, but what is the point of 
-var-update returning the list of changed variables, if it is so efficient
to go back to GDB to ask for values?  var-update might as well return nothing
and the let the front-end ask for values again.
(which is what I'll have to do if I can't cache all formats)

I thought var-update told the front-end which variables changed and more
importantly, which variables did -not- change, specifically so that the
front-end would not need to request values that did not change.
To be able to do this, the front-end must cache the value, even if it is
only in a single format.   
Why does it make sense to cache the value for one format but not for all?

> Here's a possible solution:
> 0. Apply my patch :-)
> 1. If a user changes format, use -var-set-format + -var-evaluate-expression,
> and cache the value.
> 2. After step, do -var-update. With my patch, this will compare the formatted
> value (recomputed after -var-set-format) with the new formatted value. 
> 3. If a variable is reported as changed, clear all cached formats for it.
> 
> The only case where it won't work is your example of floating variables
> -- when you have float and changed the format to integer, then change of
> value from 1.1 to 1.2 won't be detected.

Yes the float (and string) issue remains my last problem with the cache.
Even if this is a rare case, the cache must be right all the time,
not most of the time :-)  If not, I cannot have a cache.

Nick wrote:

> I don't like this change.  If I change the format to hexadecimal, 11 -> 0xb
> say, the display should change, so I would like GDB to report it through
> -var-update.

> Previously -var-evaluate-expression was needed because values weren't
> displayed when variable objects were created (-var-create now includes the
> value field, -var-list-children has the --all-values option).  Given that
> -var-update provides a record of all changes, I'm not sure that
> -var-evaluate-expression is necessary now.

It is starting to come together now :-)
What you are missing is for -var-set-format to have the --all-values flag.
Then, I believe you can stop using -var-evaluate-expression.  Using -var-update
instead of var-evaluate-expression or -var-set-format --all-values seems kind
of a hack...

What do you think of that?  Vladimir's patch and --all-values in set-format?
To me, it seems like the proper solution.

Marc


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