Update stored rendition of varobj value when format changes.
authorVladimir Prus <vladimir@codesourcery.com>
Mon, 4 Feb 2008 06:14:20 +0000 (06:14 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Mon, 4 Feb 2008 06:14:20 +0000 (06:14 +0000)
* varobj.c (varobj_set_display_format): Recomputed
        print_value.
        (c_value_of_variable): Return print_value.

gdb/ChangeLog
gdb/varobj.c

index e100a1a984bf8cb77a5c95eb5c907fd5b8cf0d81..626347167cc8b6ee7e455aee4f716c3bb18bd5c6 100644 (file)
@@ -1,3 +1,10 @@
+2008-02-04  Vladimir Prus  <vladimir@codesourcery.com>
+
+       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  <dje@google.com>
 
        * eval.c (evaluate_subexp_standard): Fix type of result of mixed
index 468beea734a9566d95e79d8191699fafa51938c7..258e0bff255f4f3a7ffd24734962ed9b29aa9f79 100644 (file)
@@ -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);
          }
       }
     }