From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16390 invoked by alias); 16 Mar 2010 21:04:46 -0000 Received: (qmail 16381 invoked by uid 22791); 16 Mar 2010 21:04:45 -0000 X-SWARE-Spam-Status: No, hits=-7.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS 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, 16 Mar 2010 21:04:39 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2GL4D05006180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 16 Mar 2010 17:04:13 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2GL4AxG015652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Mar 2010 17:04:12 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o2GL49fK032741; Tue, 16 Mar 2010 22:04:09 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o2GL47um032717; Tue, 16 Mar 2010 22:04:07 +0100 Date: Tue, 16 Mar 2010 21:04:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: Tom Tromey , Chandru , gdb-patches@sourceware.org Subject: Re: gdb can't print array element for fortran Message-ID: <20100316210407.GA31417@host0.dyn.jankratochvil.net> References: <201003121836.24712.chandru@in.ibm.com> <20100315171325.GN3045@adacore.com> <20100315234543.GA25216@host0.dyn.jankratochvil.net> <20100316151621.GB3830@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100316151621.GB3830@adacore.com> User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2010-03/txt/msg00609.txt.bz2 On Tue, 16 Mar 2010 16:16:21 +0100, Joel Brobecker wrote: > This seems like a reasonable workaround, especially since we already > have some special handling of attr->form == DW_FORM_block1 for range > types. So I guess we never have block2/block4 or even block attributes > for the upper bound in practice? * I cannot imagine a case something else than DW_FORM_block1 would be used but sure GDB should handled all the DW_FORM_block* cases to be correct. * The maintained offtrunk patch archer-jankratochvil-vla is using attr_form_is_block() for the full DW_FORM_block* support. * As the existing FSF GDB code was already limited to DW_FORM_block1. * The new patch code fragment application scope should match the scope of the existing FSF GDB code. * This patch will need to be reverted/merged-out on future import of some form of the archer-jankratochvil-vla branch therefore I wanted to minimize any effort for its import as it should have been spent rather on preparing archer-jankratochvil-vla for the merge instead. => Chose the minimal patchset satisfying Chandru's requirements. > > range_type = create_range_type (NULL, base_type, low, high); > > > > + if (attr && attr->form == DW_FORM_block1) > > + TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; > > Can you add a quick comment, with a FIXME to show that this is temporary? > There's already some useful comments just slightly earlier in the code, > perhaps we just ought to refer to that, somehow. Done (forgot the FIXME keyword I see now, sorry). > Pre-approved with the addition of the comment. Checked-in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2010-03/msg00158.html --- src/gdb/ChangeLog 2010/03/16 18:47:14 1.11491 +++ src/gdb/ChangeLog 2010/03/16 20:51:23 1.11492 @@ -1,3 +1,10 @@ +2010-03-16 Jan Kratochvil + Chandru + + * dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED. + * valarith.c (value_subscripted_rvalue): Suppress error if + TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. + 2010-03-16 Holger Hans Peter Freyther * linux-record.c (record_linux_msghdr): Remove unintended semicolons. --- src/gdb/dwarf2read.c 2010/03/15 20:49:53 1.368 +++ src/gdb/dwarf2read.c 2010/03/16 20:51:23 1.369 @@ -6074,6 +6074,12 @@ range_type = create_range_type (NULL, base_type, low, high); + /* Mark arrays with dynamic length at least as an array of unspecified + length. GDB could check the boundary but before it gets implemented at + least allow accessing the array elements. */ + if (attr && attr->form == DW_FORM_block1) + TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + name = dwarf2_name (die, cu); if (name) TYPE_NAME (range_type) = name; --- src/gdb/valarith.c 2010/02/11 21:45:25 1.81 +++ src/gdb/valarith.c 2010/03/16 20:51:23 1.82 @@ -198,7 +198,8 @@ unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); struct value *v; - if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type)) + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) + && elt_offs >= TYPE_LENGTH (array_type))) error (_("no such vector element")); v = allocate_value (elt_type);