From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19053 invoked by alias); 2 Sep 2009 23:48:51 -0000 Received: (qmail 19043 invoked by uid 22791); 2 Sep 2009 23:48:50 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_17,SPF_PASS X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Sep 2009 23:48:45 +0000 Received: from totara (unknown [123.255.29.40]) by viper.snap.net.nz (Postfix) with ESMTP id 508C03DA863 for ; Thu, 3 Sep 2009 11:48:37 +1200 (NZST) Received: by totara (Postfix, from userid 1000) id 405B0C164; Thu, 3 Sep 2009 11:48:36 +1200 (NZST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19103.1108.215005.684662@totara.tehura.co.nz> Date: Wed, 02 Sep 2009 23:48:00 -0000 To: gdb-patches@sources.redhat.com Subject: [PATCH] varobj.c: Report changed values that use a pretty-printer From: nickrob@snap.net.nz (Nick Roberts) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00071.txt.bz2 I've had a play with pretty printing in MI and it looks really neat. I've got Emacs to display map objects as described on Trom Tromey's page: http://tromey.com/blog/?p=546 There have been a few problems, notably changed values don't seem to get reported by -var-update. The patch below seems to fix this. I think the expectation might have been that continue would break out of the if statement when v->children_requested was false, but it breaks out of the whole loop so the varobj_update_result, r, never gets pushed on to result, even when r.changed is 1. When children are added the usual syntax of -var-update breaks and I get something like: "^done,changelist=[{name=\"var5\",value=\"std::tr1::unordered_map with 2 elements\",in_scope=\"true\",type_changed=\"false\",displayhint=\"map\",children=[{name=\"var5.[0]\",exp=\"[0]\",numchild=\"0\",value=\"1\",type=\"const int\",thread-id=\"1\"},... e.g displayhint and children fields which aren't usually there and all children including those which have _not_ changed get reported. I think the normal syntax could be used and just the new children reported and the front end could be made handle this. The scope of this work seems enormous as it opens the possiblity of formatting the watch expressions of all STL containers (as, ISTR, is already done in Totalview). Of course the amount of work it entails is probably enormous too and the problem, as always, is finding someone to do it. GSoC 2009 worked well with Emacs and Dmitry. I know it's a long way off, but perhaps we could think about planning something for 2010. -- Nick http://www.inet.net.nz/~nickrob 2009-09-03 Nick Roberts * varobj.c (varobj_update): Ensure that changed values are reported when using a pretty-printer. *** varobj.c 28 Aug 2009 15:11:29 +1200 1.147 --- varobj.c 03 Sep 2009 02:47:39 +1200 *************** VEC(varobj_update_result) *varobj_update *** 1545,1581 **** int i, children_changed; varobj_p tmp; ! if (!v->children_requested) ! continue; ! ! if (v->frozen) ! continue; ! ! /* If update_dynamic_varobj_children returns 0, then we have ! a non-conforming pretty-printer, so we skip it. */ ! if (update_dynamic_varobj_children (v, &changed, &new_and_unchanged, ! &children_changed)) { ! if (children_changed) ! r.children_changed = 1; ! for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i) ! { ! varobj_update_result r = {tmp}; ! r.changed = 1; ! r.value_installed = 1; ! VEC_safe_push (varobj_update_result, stack, &r); ! } ! for (i = 0; ! VEC_iterate (varobj_p, new_and_unchanged, i, tmp); ! ++i) { ! varobj_update_result r = {tmp}; ! r.value_installed = 1; ! VEC_safe_push (varobj_update_result, stack, &r); } - if (r.changed || r.children_changed) - VEC_safe_push (varobj_update_result, result, &r); - continue; } } --- 1545,1578 ---- int i, children_changed; varobj_p tmp; ! if (v->children_requested && !v->frozen) { ! /* If update_dynamic_varobj_children returns 0, then we have ! a non-conforming pretty-printer, so we skip it. */ ! if (update_dynamic_varobj_children (v, &changed, &new_and_unchanged, ! &children_changed)) { ! if (children_changed) ! r.children_changed = 1; ! for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i) ! { ! varobj_update_result r = {tmp}; ! r.changed = 1; ! r.value_installed = 1; ! VEC_safe_push (varobj_update_result, stack, &r); ! } ! for (i = 0; ! VEC_iterate (varobj_p, new_and_unchanged, i, tmp); ! ++i) ! { ! varobj_update_result r = {tmp}; ! r.value_installed = 1; ! VEC_safe_push (varobj_update_result, stack, &r); ! } ! if (r.changed || r.children_changed) ! VEC_safe_push (varobj_update_result, result, &r); ! continue; } } }