From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15621 invoked by alias); 24 Mar 2008 21:00:12 -0000 Received: (qmail 15613 invoked by uid 22791); 24 Mar 2008 21:00:12 -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; Mon, 24 Mar 2008 20:59:37 +0000 Received: from kahikatea.snap.net.nz (58.31.255.123.static.snap.net.nz [123.255.31.58]) by viper.snap.net.nz (Postfix) with ESMTP id 98BE33DA4B8; Tue, 25 Mar 2008 09:59:29 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 0843C8FC6D; Tue, 25 Mar 2008 08:59:21 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18408.5672.791817.808097@kahikatea.snap.net.nz> Date: Mon, 24 Mar 2008 21:00:00 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: per-thread variable objects In-Reply-To: <200803242046.07322.vladimir@codesourcery.com> References: <200803242046.07322.vladimir@codesourcery.com> X-Mailer: VM 7.19 under Emacs 22.1.92.2 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/msg00366.txt.bz2 > I've checked it the following revision of Nick's previous > patch (http://permalink.gmane.org/gmane.comp.gdb.devel/22707) that > makes variable object remember the thread they belong to. > I've tested this manually, proper thread and docs will be following > shortly. > > Nick, > the changes I've made are as follows: > > - I use the valid_block instead of special -2 value > to check if a varobj is global. > - I did not use -1 value to indicate the thread is gone. Presently, > we don't specifically mark variables object whose frame is gone, > and I don't see why we should be do differently for threads. > > If something seems wrong, please say. It would be nice to reach an agreement before the changes are commmitted. Clearly as maintainer, you have final say if we can't reach such an agreement. The final patch looks cleaner than my original one and appears to do the same thing. Thanks. > Index: gdb/ChangeLog > =================================================================== > RCS file: /cvs/src/src/gdb/ChangeLog,v > retrieving revision 1.9247 > diff -u -p -r1.9247 ChangeLog > --- gdb/ChangeLog 23 Mar 2008 17:29:32 -0000 1.9247 > +++ gdb/ChangeLog 24 Mar 2008 17:31:09 -0000 > @@ -1,3 +1,15 @@ >... I think ChangeLog entries shouldn't be presented as diffs. >... > +/* If frame associated with VAR can be found, switch > + to it and return 1. Otherwise, return 0. */ It's not enough for a frame to be found, the pc also has to have an address value within the valid block. This is one reason why, for such small functions, I would rather the code spoke for itself. > +static int > +check_scope (struct varobj *var) > +{ > + struct frame_info *fi; > + int scope; > + > + fi = frame_find_by_id (var->root->frame); > + scope = fi != NULL; > + > + if (fi) > + { > + CORE_ADDR pc = get_frame_pc (fi); > + if (pc < BLOCK_START (var->root->valid_block) || > + pc >= BLOCK_END (var->root->valid_block)) > + scope = 0; > + else > + select_frame (fi); > + } > + return scope; > +} -- Nick http://www.inet.net.nz/~nickrob