From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 828 invoked by alias); 29 Mar 2008 06:38:25 -0000 Received: (qmail 818 invoked by uid 22791); 29 Mar 2008 06:38:24 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 29 Mar 2008 06:38:07 +0000 Received: (qmail 31380 invoked from network); 29 Mar 2008 06:38:04 -0000 Received: from unknown (HELO localhost) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Mar 2008 06:38:04 -0000 From: Vladimir Prus To: Nick Roberts Subject: Re: -var-update @ Date: Sat, 29 Mar 2008 06:38:00 -0000 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) Cc: gdb-patches@sources.redhat.com References: <200803261754.10513.vladimir@codesourcery.com> <200803271338.24328.vladimir@codesourcery.com> <18413.53371.781723.755958@kahikatea.snap.net.nz> In-Reply-To: <18413.53371.781723.755958@kahikatea.snap.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200803290937.57101.vladimir@codesourcery.com> 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/msg00483.txt.bz2 On Saturday 29 March 2008 08:15:39 Nick Roberts wrote: > *** varobj.c.~1.108.~=A0=A0=A02008-03-27 08:02:16.000000000 +1200 > --- varobj.c=A0=A0=A0=A02008-03-29 17:06:35.000000000 +1200 > *************** varobj_update (struct varobj **varp, str > *** 1160,1177 **** > =A0 =A0=A0=A0=A0=A0=A0 has changed. =A0*/ > =A0 =A0 =A0 =A0 new =3D value_of_root (varp, &type_changed); > =A0 =A0 =A0 =A0=20 > ! =A0 =A0 =A0 /* If this is a floating varobj, and its type has changed, > ! =A0=A0=A0=A0=A0=A0 them note that it's changed. =A0*/ > ! =A0 =A0 =A0 if (type_changed) > =A0 =A0=A0=A0=A0=A0=A0VEC_safe_push (varobj_p, result, *varp); > =A0 =A0 =A0 =A0=20 > ! =A0 =A0 =A0 =A0 if (install_new_value ((*varp), new, type_changed)) > ! =A0=A0=A0=A0=A0=A0 =A0{ > ! =A0=A0=A0=A0=A0=A0 =A0 =A0/* If type_changed is 1, install_new_value wi= ll never return > ! =A0=A0=A0=A0=A0=A0 =A0 =A0 =A0 non-zero, so we'll never report the same= variable twice. =A0*/ > ! =A0=A0=A0=A0=A0=A0 =A0 =A0gdb_assert (!type_changed); > ! =A0=A0=A0=A0=A0=A0 =A0 =A0VEC_safe_push (varobj_p, result, *varp); > ! =A0=A0=A0=A0=A0=A0 =A0} > =A0=20 > =A0 =A0 =A0 =A0 if (new =3D=3D NULL) > =A0 =A0=A0=A0=A0=A0=A0{ > --- 1160,1176 ---- > =A0 =A0=A0=A0=A0=A0=A0 has changed. =A0*/ > =A0 =A0 =A0 =A0 new =3D value_of_root (varp, &type_changed); > =A0 =A0 =A0 =A0=20 > ! =A0 =A0 =A0 /* If this is a floating varobj, then note that it's change= d. =A0*/ > ! =A0 =A0 =A0 if ((*varp)->root->floating) > =A0 =A0=A0=A0=A0=A0=A0VEC_safe_push (varobj_p, result, *varp); What is the logic here? Surely, a floating varobj might as well not change. =A0 =A0 =A0 =A0=20 > ! =A0 =A0 =A0 if (install_new_value ((*varp), new, type_changed)) > ! =A0=A0=A0=A0=A0=A0{ > ! =A0=A0=A0=A0=A0=A0 =A0/* If type_changed is 1, install_new_value will n= ever return > ! =A0=A0=A0=A0=A0=A0 =A0 =A0 non-zero, so we'll never report the same var= iable twice. =A0*/ > ! =A0=A0=A0=A0=A0=A0 =A0gdb_assert (!type_changed); > ! =A0=A0=A0=A0=A0=A0 =A0VEC_safe_push (varobj_p, result, *varp); > ! =A0=A0=A0=A0=A0=A0} > =A0=20 > =A0 =A0 =A0 =A0 if (new =3D=3D NULL) > =A0 =A0=A0=A0=A0=A0=A0{ > *************** value_of_root (struct varobj **var_handl > *** 1738,1758 **** > =A0 =A0 =A0 =A0 old_type =3D varobj_get_type (var); > =A0 =A0 =A0 =A0 new_type =3D varobj_get_type (tmp_var); > =A0 =A0 =A0 =A0 if (strcmp (old_type, new_type) =3D=3D 0) > - =A0=A0=A0=A0=A0=A0{ > - =A0=A0=A0=A0=A0=A0 =A0varobj_delete (tmp_var, NULL, 0); > =A0 =A0=A0=A0=A0=A0=A0 =A0*type_changed =3D 0; > - =A0=A0=A0=A0=A0=A0} > =A0 =A0 =A0 =A0 else > - =A0=A0=A0=A0=A0=A0{ > - =A0=A0=A0=A0=A0=A0 =A0tmp_var->obj_name =3D > - =A0=A0=A0=A0=A0=A0 =A0 =A0savestring (var->obj_name, strlen (var->obj_n= ame)); > - =A0=A0=A0=A0=A0=A0 =A0varobj_delete (var, NULL, 0); > -=20 > - =A0=A0=A0=A0=A0=A0 =A0install_variable (tmp_var); > - =A0=A0=A0=A0=A0=A0 =A0*var_handle =3D tmp_var; > - =A0=A0=A0=A0=A0=A0 =A0var =3D *var_handle; > =A0 =A0=A0=A0=A0=A0=A0 =A0*type_changed =3D 1; > ! =A0=A0=A0=A0=A0=A0} > =A0 =A0 =A0 =A0 xfree (old_type); > =A0 =A0 =A0 =A0 xfree (new_type); > =A0 =A0 =A0 } > --- 1737,1753 ---- > =A0 =A0 =A0 =A0 old_type =3D varobj_get_type (var); > =A0 =A0 =A0 =A0 new_type =3D varobj_get_type (tmp_var); > =A0 =A0 =A0 =A0 if (strcmp (old_type, new_type) =3D=3D 0) > =A0 =A0=A0=A0=A0=A0=A0 =A0*type_changed =3D 0; > =A0 =A0 =A0 =A0 else > =A0 =A0=A0=A0=A0=A0=A0 =A0*type_changed =3D 1; > !=20 > ! =A0 =A0 =A0 tmp_var->obj_name =3D > ! =A0=A0=A0=A0=A0=A0savestring (var->obj_name, strlen (var->obj_name)); > ! =A0 =A0 =A0 varobj_delete (var, NULL, 0); > ! =A0 =A0 =A0 install_variable (tmp_var); > ! =A0 =A0 =A0 *var_handle =3D tmp_var; > ! =A0 =A0 =A0 var =3D *var_handle; > !=20 > =A0 =A0 =A0 =A0 xfree (old_type); > =A0 =A0 =A0 =A0 xfree (new_type); > =A0 =A0 =A0 } Hmm, I see. This actually causes a new varobj to be created each time. > 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. So, we still don't know why the current code does not work? I think we still get to figure out, to make sure that whatever bug there is does not affect other cases. - Volodya