From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13351 invoked by alias); 24 Mar 2008 05:44:22 -0000 Received: (qmail 13343 invoked by uid 22791); 24 Mar 2008 05:44:22 -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; Mon, 24 Mar 2008 05:44:05 +0000 Received: (qmail 28570 invoked from network); 24 Mar 2008 05:44:01 -0000 Received: from unknown (HELO localhost) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Mar 2008 05:44:01 -0000 From: Vladimir Prus To: Nick Roberts Subject: Re: Thread bound variable objects [was: Re: MI non-stop mode spec] Date: Mon, 24 Mar 2008 07:18:00 -0000 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) Cc: gdb@sources.redhat.com References: <200803190016.02072.vladimir@codesourcery.com> <200803231225.31593.vladimir@codesourcery.com> <18407.10216.545852.450467@kahikatea.snap.net.nz> In-Reply-To: <18407.10216.545852.450467@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: <200803240843.54604.vladimir@codesourcery.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00199.txt.bz2 On Monday 24 March 2008 07:02:48 Nick Roberts wrote: > > > + =A0 do_cleanups (old_cleanups); > > > +=20 > > > =A0 =A0 return NULL; > > > =A0 } > >=20 > > I think the use of cleanups above is wrong. You basically have: > >=20 > > struct cleanups *old_cleanups =3D NULL; > > if (whatever) > > old_cleanups =3D ... > > do_cleanups (old_cleanups); > >=20 > > so, if 'whatever' evaluates to false, all cleanups, including those set > > in parent, will be executed. >=20 > OK, it should be: >=20 > + if (old_cleanups !=3D NULL) > + do_cleanups (old_cleanups); I think that's also wrong. In the event that no cleanups were installed before calling this function, this code will fail to run the cleanups installed by this function. In the event that a cleanup should be really installed conditionally, the right code is: struct cleanups *back_to =3D make_cleanup (null_cleanup, NULL); if (...) make_cleanup (); do_cleanups (back_to); > > That's what we get for using a language that does not have exceptions > > and proper destructors. I'll fix this too. >=20 > I see now from the ChangeLog that you've committed your own change without > posting to the list first or explaining what it does. Sorry, no: 1. I've checked in two changes, not one. 2. Both are posted to gdb-patches. 3. Both are general cleanups, and don't implement anything that your patch tries to implement. > My patch does two things: >=20 > 1) It stops a variable object from being considered automatically out of > scope when the selected thread changes. > 2) It associates a thread-id field with the variable object so that the > front end can organise the display of watch expressions accordingly. >=20 > AFAICS your patch does neither of these. Could you please say what it > does do? Please see my gdb-patches posts. - Volodya