From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9147 invoked by alias); 21 Jan 2014 20:47:15 -0000 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 Received: (qmail 9138 invoked by uid 89); 21 Jan 2014 20:47:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Jan 2014 20:47:14 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0LKlA8a022030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jan 2014 15:47:10 -0500 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0LKl98T017772 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 21 Jan 2014 15:47:10 -0500 Message-ID: <52DEDCCD.9030207@redhat.com> Date: Tue, 21 Jan 2014 20:47:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 09/11] Delete varobj's children on traceframe is changed. References: <1385258996-26047-1-git-send-email-yao@codesourcery.com> <1385258996-26047-10-git-send-email-yao@codesourcery.com> In-Reply-To: <1385258996-26047-10-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00822.txt.bz2 On 11/23/2013 06:09 PM, Yao Qi wrote: > In this patch, we install a traceframe_changed observer to clear > varobjs marked as 'available_children_only'. > Once again, only some minor comments. Keith > gdb: > > 2013-11-24 Yao Qi > > * varobj.c: Include "observer.h". > (varobj_delete_if_available_children_only): New function. > (varobj_traceframe_changed): New function. > (_initialize_varobj): Install varobj_traceframe_changed to > traceframe_changed observer. > --- > gdb/varobj.c | 29 +++++++++++++++++++++++++++++ > 1 files changed, 29 insertions(+), 0 deletions(-) > > diff --git a/gdb/varobj.c b/gdb/varobj.c > index ba93eb5..4b201df 100644 > --- a/gdb/varobj.c > +++ b/gdb/varobj.c > @@ -24,6 +24,7 @@ > #include "gdbcmd.h" > #include "block.h" > #include "valprint.h" > +#include "observer.h" > > #include "gdb_assert.h" > #include > @@ -2749,6 +2750,32 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) > (*func) (var_root->rootvar, data); > } > } > + > +/* Delete VAR's children if it is marked as 'available_children_only'. */ > + > +static void > +varobj_delete_if_available_children_only (struct varobj *var, void *data) > +{ > + if (var->dynamic->available_children_only) > + { > + varobj_delete (var, NULL, /* children only */ 1); > + var->num_children = -1; > + > + /* We're starting over, so get rid of any iterator. */ This comment doesn't really make sense here. Best to just get rid of it. [cut-n-paste-o?] > + varobj_iter_delete (var->dynamic->child_iter); > + var->dynamic->child_iter = NULL; > + varobj_clear_saved_item (var->dynamic); > + } > +} > + The above code looks like it is duplicated in varobj_set_available_children_only. That suggests that a common function could be introduced to do this. > +/* Installed on traceframe_changed observer. */ "The callback installed for traceframe_changed events." > + > +static void > +varobj_traceframe_changed (int tfnum, int tpnum) > +{ > + all_root_varobjs (varobj_delete_if_available_children_only , NULL); > +} > + > > extern void _initialize_varobj (void); > void > @@ -2766,6 +2793,8 @@ _initialize_varobj (void) > _("When non-zero, varobj debugging is enabled."), > NULL, show_varobjdebug, > &setlist, &showlist); > + > + observer_attach_traceframe_changed (varobj_traceframe_changed); > } > > /* Invalidate varobj VAR if it is tied to locals and re-create it if it is >