From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6162 invoked by alias); 29 Mar 2008 05:16:21 -0000 Received: (qmail 6153 invoked by uid 22791); 29 Mar 2008 05:16:19 -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; Sat, 29 Mar 2008 05:15:53 +0000 Received: from kahikatea.snap.net.nz (189.61.255.123.dynamic.snap.net.nz [123.255.61.189]) by viper.snap.net.nz (Postfix) with ESMTP id AD54B3DA75B; Sat, 29 Mar 2008 18:15:45 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 38F448FC6D; Sat, 29 Mar 2008 17:15:41 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18413.53371.781723.755958@kahikatea.snap.net.nz> Date: Sat, 29 Mar 2008 05:16:00 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: -var-update @ In-Reply-To: <200803271338.24328.vladimir@codesourcery.com> References: <200803261754.10513.vladimir@codesourcery.com> <20080327095334.67CCE8FC6D@kahikatea.snap.net.nz> <200803271338.24328.vladimir@codesourcery.com> X-Mailer: VM 7.19 under Emacs 23.0.60.52 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: 2008-03/txt/msg00482.txt.bz2 > > -var-update --all-values var1 > > ^done,changelist=[{name="var1",in_scope="true",new_type="float",new_num_children="0"}] > > (gdb) > > -var-update --all-values var2 > > ^done,changelist=[{name="var2",value="-1080652880",in_scope="true",type_changed="false"}] > > (gdb) > > This is weird. I did not look at var1 missing new value (should be easy), > but the var2 behaviour is strange. Evaluating 'myvar1' by hand gives the > right value, whereas -var-update gives this apparent garbage. My guess is > that that parsed expression somehow holds on to frame. I'll look further. I think the patch below fixes the behaviour for var2. There may be a less expensive way to do this, e.g, just update the "struct value", but I don't know how to do that. > > > > I think we should fix (and document) such floating variable objects > > > > > > We should; I was not aware of the bug with wrong value you report above. There's still no doc or tests for this type of varobj. > > > > I would just suggest a more consistent syntax as currently: > > > > -var-update @ Updates all floating variable objects. > > -var-update * Updates all variable objects. > > -var-update var1 Updates the variable object var1 (floating or otherwise). > > > > -var-create - @ Creates a floating variable object. > > -var-create - * Creates a fixed frame variable object. > > IIUC, the above is that current syntax? If yes, how do you propose to > change. If this is the proposed syntax, can you spell out the difference > from the current one? This is the current syntax which I find confusing because "*" means "fixed" in one context and "all" in another. I'm not sure how to change it and remain backward compatible. -- Nick http://www.inet.net.nz/~nickrob 2008-03-29 Nick Roberts * varobj.c (varobj_update): Always mark floating variable objects as changed. (value_of_root): Always recreate a floating variable object. *** varobj.c.~1.108.~ 2008-03-27 08:02:16.000000000 +1200 --- varobj.c 2008-03-29 17:06:35.000000000 +1200 *************** varobj_update (struct varobj **varp, str *** 1160,1177 **** has changed. */ new = value_of_root (varp, &type_changed); ! /* If this is a floating varobj, and its type has changed, ! them note that it's changed. */ ! if (type_changed) VEC_safe_push (varobj_p, result, *varp); ! if (install_new_value ((*varp), new, type_changed)) ! { ! /* If type_changed is 1, install_new_value will never return ! non-zero, so we'll never report the same variable twice. */ ! gdb_assert (!type_changed); ! VEC_safe_push (varobj_p, result, *varp); ! } if (new == NULL) { --- 1160,1176 ---- has changed. */ new = value_of_root (varp, &type_changed); ! /* If this is a floating varobj, then note that it's changed. */ ! if ((*varp)->root->floating) VEC_safe_push (varobj_p, result, *varp); ! if (install_new_value ((*varp), new, type_changed)) ! { ! /* If type_changed is 1, install_new_value will never return ! non-zero, so we'll never report the same variable twice. */ ! gdb_assert (!type_changed); ! VEC_safe_push (varobj_p, result, *varp); ! } if (new == NULL) { *************** value_of_root (struct varobj **var_handl *** 1738,1758 **** old_type = varobj_get_type (var); new_type = varobj_get_type (tmp_var); if (strcmp (old_type, new_type) == 0) - { - varobj_delete (tmp_var, NULL, 0); *type_changed = 0; - } else - { - tmp_var->obj_name = - savestring (var->obj_name, strlen (var->obj_name)); - varobj_delete (var, NULL, 0); - - install_variable (tmp_var); - *var_handle = tmp_var; - var = *var_handle; *type_changed = 1; ! } xfree (old_type); xfree (new_type); } --- 1737,1753 ---- old_type = varobj_get_type (var); new_type = varobj_get_type (tmp_var); if (strcmp (old_type, new_type) == 0) *type_changed = 0; else *type_changed = 1; ! ! tmp_var->obj_name = ! savestring (var->obj_name, strlen (var->obj_name)); ! varobj_delete (var, NULL, 0); ! install_variable (tmp_var); ! *var_handle = tmp_var; ! var = *var_handle; ! xfree (old_type); xfree (new_type); }