From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10683 invoked by alias); 3 Sep 2009 18:11:57 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 10659 invoked by uid 306); 3 Sep 2009 18:11:57 -0000 Date: Thu, 03 Sep 2009 18:11:00 -0000 Message-ID: <20090903181157.10644.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: Fix PR 10584 X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 09ff6f198a5ff0de41e7808532422c807db9d967 X-Git-Newrev: 6e7d259f6a49bb3be0f6d94241519c7d23363cdf X-SW-Source: 2009-q3/txt/msg00172.txt.bz2 List-Id: 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 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.