From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23166 invoked by alias); 2 Nov 2010 22:45:30 -0000 Received: (qmail 23153 invoked by uid 22791); 2 Nov 2010 22:45:29 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Nov 2010 22:45:24 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA2MjJmV001404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Nov 2010 18:45:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oA2MjIEC019170; Tue, 2 Nov 2010 18:45:18 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oA2MjHeb022207; Tue, 2 Nov 2010 18:45:18 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 3D90A8880C9; Tue, 2 Nov 2010 16:31:03 -0600 (MDT) From: Tom Tromey To: Ken Werner Cc: gdb-patches@sourceware.org Subject: Re: [patch] DW_AT_byte_size for array type entries References: <201010191323.57251.ken@linux.vnet.ibm.com> <201010192016.05535.ken@linux.vnet.ibm.com> Date: Tue, 02 Nov 2010 22:45:00 -0000 In-Reply-To: <201010192016.05535.ken@linux.vnet.ibm.com> (Ken Werner's message of "Tue, 19 Oct 2010 20:16:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-11/txt/msg00054.txt.bz2 >>>>> "Ken" == Ken Werner writes: Ken> Index: gdb/c-valprint.c Ken> =================================================================== Ken> RCS file: /cvs/src/src/gdb/c-valprint.c,v Ken> retrieving revision 1.74 Ken> diff -p -u -r1.74 c-valprint.c Ken> --- gdb/c-valprint.c 15 Oct 2010 18:54:12 -0000 1.74 Ken> +++ gdb/c-valprint.c 19 Oct 2010 12:15:30 -0000 Ken> @@ -171,8 +171,13 @@ c_val_print (struct type *type, const gd Ken> elttype = check_typedef (unresolved_elttype); Ken> if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) Ken> { Ken> + LONGEST low_bound, high_bound; Ken> + Ken> + if (!get_array_bounds(type, &low_bound, &high_bound)) Missing space before open paren. Ken> + error (_("Could not determine the array high bound")); Ken> + Ken> eltlen = TYPE_LENGTH (elttype); Ken> - len = TYPE_LENGTH (type) / eltlen; Ken> + len = high_bound - low_bound + 1; I guess it is ok to use 'eltlen' elsewhere in the function because it is only the array's overall size which is "weird" -- the element size is still correct. (Since we don't implement the DWARF stride stuff...) The patch is ok with the above nit fixed. I wonder whether f-valprint.c also needs an update. Tom