From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17726 invoked by alias); 25 Jan 2007 22:31:51 -0000 Received: (qmail 17716 invoked by uid 22791); 25 Jan 2007 22:31:50 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 25 Jan 2007 22:31:43 +0000 Received: from kahikatea.snap.net.nz (243.61.255.123.dynamic.snap.net.nz [123.255.61.243]) by viper.snap.net.nz (Postfix) with ESMTP id 28B9D3D839F; Fri, 26 Jan 2007 11:31:39 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 2DD0B4F720; Fri, 26 Jan 2007 11:31:36 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17849.12231.246980.478169@kahikatea.snap.net.nz> Date: Thu, 25 Jan 2007 22:31:00 -0000 To: Denis PILAT Cc: Daniel Jacobowitz , gdb-patches Subject: Re: [RFC] varobj deletion after the binary has changed In-Reply-To: <45B8E8A8.9040904@st.com> References: <45B60056.6030704@st.com> <20070123124457.GA1600@nevyn.them.org> <45B63A49.4010609@st.com> <45B8E8A8.9040904@st.com> X-Mailer: VM 7.19 under Emacs 22.0.93.1 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: 2007-01/txt/msg00525.txt.bz2 To avoid confusion these are my opinions; I don't have authority to approve the patch. > --- varobj.c (revision 552) > +++ varobj.c (working copy) > @@ -77,6 +77,10 @@ struct varobj_root > > /* Next root variable */ > struct varobj_root *next; > + > + /* Flag that indicates validity: set to 0 when this varobj_root refers > + to symbols that do not exist anymore. */ > + int is_valid; > }; I would move the is_valid member before *next. > /* Every variable in the system has a structure of this type defined > @@ -912,6 +916,9 @@ varobj_update (struct varobj **varp, str > /* Not a root var */ > return -1; > > + if (!(*varp)->root->is_valid) > + return -1; This seems to make the variable object some kind of zombie. Wouldn't it be better to make GDB report something like: ^done,changelist=[{name="var1",in_scope="invalid",type_changed="false"}] so then the frontend can choose to delete these variable objects? >... > +void > +varobj_invalidate (void) > +{ > + struct varobj **all_rootvarobj; > + struct varobj **varp; > + > + if (varobj_list (&all_rootvarobj) > 0) > + { > + varp = all_rootvarobj; > + while (*varp != NULL) > + { > + /* global var must be re-evaluated. */ > + if ((*varp)->root->valid_block == NULL) > + { > + struct varobj *tmp_var; > + > + /* try to create a varobj with same expression. if success we replace > + the old varobj, othewize we invalidate it. */ /* Try to create a varobj with same expression. If we succeed replace the old varobj, otherwise invalidate it. */ > + tmp_var = varobj_create (NULL, (*varp)->name, (CORE_ADDR) 0, USE_CURRENT_FRAME); > + if (tmp_var != NULL) > + { > + tmp_var->obj_name = > + savestring ((*varp)->obj_name, strlen ((*varp)->obj_name)); Is xstrdup just a simpler version of savestring? i.e. tmp_var->obj_name = xstrdup (*varp)->obj_name); > + varobj_delete (*varp, NULL, 0); > + install_variable (tmp_var); > + } > + else > + (*varp)->root->is_valid = 0; > + } > + else /* locals must be invalidated. */ > + (*varp)->root->is_valid = 0; > + > + varp++; > + } > + xfree (all_rootvarobj); > + } > + return; > +} >... -- Nick http://www.inet.net.nz/~nickrob