From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4486 invoked by alias); 4 Jul 2005 01:42:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4465 invoked by uid 22791); 4 Jul 2005 01:42:32 -0000 Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 04 Jul 2005 01:42:32 +0000 Received: from farnswood.snap.net.nz (p249-tnt1.snap.net.nz [202.124.110.249]) by viper.snap.net.nz (Postfix) with ESMTP id 6612C5CE472; Mon, 4 Jul 2005 13:39:21 +1200 (NZST) Received: by farnswood.snap.net.nz (Postfix, from userid 501) id 1F45862A99; Mon, 4 Jul 2005 02:41:15 +0100 (BST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17096.37817.638887.840041@farnswood.snap.net.nz> Date: Mon, 04 Jul 2005 01:42:00 -0000 To: Daniel Jacobowitz Cc: Wu Zhou , gdb-patches@sources.redhat.com Subject: Re: PATCH: Start Fortran support for variable objects. In-Reply-To: <20050703234725.GA28151@nevyn.them.org> References: <17091.4780.953681.620094@farnswood.snap.net.nz> <20050630131809.GB8241@nevyn.them.org> <17092.28833.284587.118362@farnswood.snap.net.nz> <17092.51062.559020.560618@farnswood.snap.net.nz> <20050703161706.GA13289@nevyn.them.org> <17096.30621.21570.307217@farnswood.snap.net.nz> <20050703234725.GA28151@nevyn.them.org> X-SW-Source: 2005-07/txt/msg00037.txt.bz2 > > > First of all, never reference ->main_type - see above for the right way > > > to get the low bound. An even better way (it seems) is to call > > > get_discrete_bounds. Take a look at value_subscript for an example. > > > > Better than TYPE_LOW_BOUND? > > I suppose. I don't know which one is preferred; some day, someone > should go through and clean them all up to be consistent. I'm fine > with either choice. To keep things simple I've used TYPE_LOW_BOUND. I've tested with the examples I've posted before and it works. Presumably there should also be a test case, so I'll create one for mi-var-child.exp and mi2-var-child.exp (you still haven't approved my patch for mi2-cmd-stack.exp (28 Jun 2005 01:53:52 +1200). In particular, this patch does eliminate the need for the fortran-specific code. Nick 2005-06-30 Nick Roberts * varobj.c (varobj_list_children): Allow non-zero offsets for languages like Fortran. Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.54 diff -u -p -r1.54 varobj.c --- varobj.c 26 Apr 2005 05:03:37 -0000 1.54 +++ varobj.c 4 Jul 2005 01:36:54 -0000 @@ -696,7 +696,7 @@ varobj_list_children (struct varobj *var { struct varobj *child; char *name; - int i; + int i, j, retcode; /* sanity check: have we been passed a pointer? */ if (childlist == NULL) @@ -715,11 +715,13 @@ varobj_list_children (struct varobj *var /* Mark as the end in case we bail out */ *((*childlist) + i) = NULL; + j = i + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (var->type)); + /* check if child exists, if not create */ - name = name_of_child (var, i); + name = name_of_child (var, j); child = child_exists (var, name); if (child == NULL) - child = create_child (var, i, name); + child = create_child (var, j, name); *((*childlist) + i) = child; }