From 8e91f0232ca9c286299092c896288b8657c9311b Mon Sep 17 00:00:00 2001
From: Vladimir Prus <vladimir@codesourcery.com>
Date: Sat, 19 Apr 2008 17:03:20 +0000
Subject: [PATCH] 	* mi/mi-cmd-var.c (varobj_update_one): Print new 
 value for variable objects that changed type.

---
 gdb/ChangeLog                  | 5 +++++
 gdb/mi/mi-cmd-var.c            | 2 ++
 gdb/testsuite/ChangeLog        | 6 ++++++
 gdb/testsuite/gdb.mi/var-cmd.c | 7 +++++++
 4 files changed, 20 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0f0db2d1c7..7d08e32efe 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-19  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-cmd-var.c (varobj_update_one): Print new
+	value for variable objects that changed type.
+
 2008-04-19  Vladimir Prus  <vladimir@codesourcery.com>
 
 	* varobj.c (varobj_invalidate): Don't touch floating
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 9c0df69559..2f009fa0f5 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -687,6 +687,8 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
           ui_out_field_string (uiout, "new_type", varobj_get_type(var));
           ui_out_field_int (uiout, "new_num_children", 
 			    varobj_get_num_children(var));
+	  if (mi_print_value_p (varobj_get_gdb_type (var), print_values))
+	    ui_out_field_string (uiout, "value", varobj_get_value (var));
 	  break;
       }
       if (mi_version (uiout) > 1)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ae8cfe6dda..bcf8619913 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-19  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* gdb.mi/var-cmd.c (do_at_tests): Verify that
+	'-var-update --all-values' reports new value even the type
+	of a variable object has changed.
+
 2008-04-18  Craig Silverstein  <csilvers@google.com>
 
 	* gdb.dwarf2/dw2-compressed.S, gdb.dwarf2/dw2-compressed.exp: New
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index ffc442f8ed..99542cc61b 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -450,6 +450,13 @@ void do_at_tests ()
       :*/
     i += 2.0;
   }
+  {
+    float i = 19;
+    /*:
+      mi_gdb_test "-var-update --all-values F" {.*value="19".*} "update F (--all-values)"
+      :*/
+    i += 2.0;
+  }
   i++;
   /*:
     mi_varobj_update_with_type_change F "int" "0" "update F (3)"