public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-python: Fix PR 10584
@ 2009-09-03 18:11 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2009-09-03 18:11 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-python has been updated
       via  6e7d259f6a49bb3be0f6d94241519c7d23363cdf (commit)
      from  09ff6f198a5ff0de41e7808532422c807db9d967 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 6e7d259f6a49bb3be0f6d94241519c7d23363cdf
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Sep 3 12:11:28 2009 -0600

    Fix PR 10584
    
    gdb
    	* varobj.c (install_new_value): Properly set 'changed' when a
    	pretty-printer is installed.
    	(varobj_update): Push a changed varobj even if it has no
    	children.
    gdb/testsuite
    	* gdb.python/python-prettyprint.c (string_1, string_2): New
    	globals.
    	* gdb.python/python-mi.exp: Add scalar regression test.

-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.python/python-mi.exp        |   11 ++++++++++
 gdb/testsuite/gdb.python/python-prettyprint.c |    3 ++
 gdb/varobj.c                                  |   27 ++++++++++++++++++------
 3 files changed, 34 insertions(+), 7 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.python/python-mi.exp b/gdb/testsuite/gdb.python/python-mi.exp
index 018c6a2..7791775 100644
--- a/gdb/testsuite/gdb.python/python-mi.exp
+++ b/gdb/testsuite/gdb.python/python-mi.exp
@@ -61,6 +61,17 @@ mi_delete_varobj container "delete varobj"
 
 mi_gdb_test "-enable-pretty-printing" ""
 
+mi_create_varobj_checked string string_1 \
+    "struct string_repr" \
+    "create string_1 varobj"
+
+mi_gdb_test "-data-evaluate-expression \"string_1 = string_2\"" ".*" \
+    "assign string_1 from string_2"
+
+mi_gdb_test "-var-update string" \
+    "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"}\\\]" \
+    "update string varobj after assignment"
+
 mi_create_dynamic_varobj container c \
   "create container varobj"
 
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.c b/gdb/testsuite/gdb.python/python-prettyprint.c
index 5fbd534..adf66b5 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.c
+++ b/gdb/testsuite/gdb.python/python-prettyprint.c
@@ -155,6 +155,9 @@ struct nullstr
   char *s;
 };
 
+struct string_repr string_1 = { { "one" } };
+struct string_repr string_2 = { { "two" } };
+
 int
 main ()
 {
diff --git a/gdb/varobj.c b/gdb/varobj.c
index b6a16d2..e1dec23 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1551,9 +1551,6 @@ install_new_value (struct varobj *var, struct value *value, int initial)
   var->value = value;
   if (value != NULL)
     value_incref (value);
-  if (var->print_value)
-    xfree (var->print_value);
-  var->print_value = print_value;
   if (value && value_lazy (value) && intentionally_not_fetched)
     var->not_fetched = 1;
   else
@@ -1562,6 +1559,19 @@ install_new_value (struct varobj *var, struct value *value, int initial)
 
   install_new_value_visualizer (var);
 
+  /* If we installed a pretty-printer, re-compare the printed version
+     to see if the variable changed.  */
+  if (var->pretty_printer)
+    {
+      xfree (print_value);
+      print_value = value_get_print_value (var->value, var->format, var);
+      if (!var->print_value || strcmp (var->print_value, print_value) != 0)
+	changed = 1;
+    }
+  if (var->print_value)
+    xfree (var->print_value);
+  var->print_value = print_value;
+
   gdb_assert (!var->value || value_type (var->value));
 
   return changed;
@@ -1746,11 +1756,14 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit)
 		 it as unchanged -- presumably, such varobj is not yet
 		 expanded in the UI, so we need not bother getting
 		 it.  */
-	      if (varobj_has_more (v, 0))
-		continue;
+	      if (!varobj_has_more (v, 0))
+		{
+		  update_dynamic_varobj_children (v, NULL, NULL, &dummy, 0, 0);
+		  if (varobj_has_more (v, 0))
+		    r.changed = 1;
+		}
 
-	      update_dynamic_varobj_children (v, NULL, NULL, &dummy, 0, 0);
-	      if (varobj_has_more (v, 0))
+	      if (r.changed)
 		VEC_safe_push (varobj_update_result, result, &r);
 
 	      continue;


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-03 18:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 18:11 [SCM] archer-tromey-python: Fix PR 10584 tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).