This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: -var-update using formatted value
On Friday 18 January 2008 02:10:12 Nick Roberts wrote:
> > Update stored value when format changes.
> >
> > * varobj.c (varobj_set_display_format): Recomputed
> > print_value.
> > (c_value_of_variable): Return print_value.
> >
> > diff --git a/gdb/varobj.c b/gdb/varobj.c
> > index d078bef..b0eb11a 100644
> > --- a/gdb/varobj.c
> > +++ b/gdb/varobj.c
> > @@ -677,6 +677,13 @@ varobj_set_display_format (struct varobj *var,
> > var->format = variable_default_display (var);
> > }
> >
> > + if (varobj_value_is_changeable_p (var)
> > + && var->value && !value_lazy (var->value))
> > + {
> > + free (var->print_value);
> > + var->print_value = value_get_print_value (var->value, var->format);
> > + }
> > +
> > return var->format;
> > }
> >
> > @@ -2260,7 +2267,7 @@ c_value_of_variable (struct varobj *var)
> >
> > gdb_assert (varobj_value_is_changeable_p (var));
> > gdb_assert (!value_lazy (var->value));
> > - return value_get_print_value (var->value, var->format);
> > + return strdup (var->print_value);
> > }
> > }
> > }
>
> 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.
Why? It seems to me that if user does "change format" in UI, then UI should:
1. Change format
2. Display the value shown according to the new format
I cannot imagine any usecase where the frontend would:
1. Change format
2. Step program
3. Issue -var-update
- Volodya
>