From ae7d22a6f2f59251b85ef5655b800f2dfe2dfbee Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 4 Feb 2008 06:14:20 +0000 Subject: [PATCH] Update stored rendition of varobj value when format changes. * varobj.c (varobj_set_display_format): Recomputed print_value. (c_value_of_variable): Return print_value. --- gdb/ChangeLog | 7 +++++++ gdb/varobj.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e100a1a984b..626347167cc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2008-02-04 Vladimir Prus + + Update stored rendition of varobj value when format changes. + * varobj.c (varobj_set_display_format): Recomputed + print_value. + (c_value_of_variable): Return print_value. + 2008-02-03 Doug Evans * eval.c (evaluate_subexp_standard): Fix type of result of mixed diff --git a/gdb/varobj.c b/gdb/varobj.c index 468beea734a..258e0bff255 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -673,6 +673,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; } @@ -2245,7 +2252,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); } } } -- 2.30.2