From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8511 invoked by alias); 9 Jan 2008 09:22:08 -0000 Received: (qmail 8503 invoked by uid 22791); 9 Jan 2008 09:22:07 -0000 X-Spam-Check-By: sourceware.org Received: from ics.u-strasbg.fr (HELO ics.u-strasbg.fr) (130.79.112.250) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 09:21:48 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id A7D9A18701A; Wed, 9 Jan 2008 10:25:35 +0100 (CET) From: "Pierre Muller" To: "'Joel Brobecker'" , References: <20080109063342.GE20580@adacore.com> In-Reply-To: <20080109063342.GE20580@adacore.com> Subject: RE: [RFA] Add handling of null Ada arrays Date: Wed, 09 Jan 2008 09:22:00 -0000 Message-ID: <000401c852a1$0bdb1aa0$23914fe0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us 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-01/txt/msg00176.txt.bz2 At least in pascal language it is quite common to use things like type BigArray = Array [1..0xffffffff] of integer; if you want to be sure that you will never get into troubles due to range checking... Of course you cannot allocate a pointer to such a type directly, and it would eat up a lot of memory space. But this kind of types always gave problems inside gdb, because when you wanted to look at the value gdb would try to copy the whole array... even if cases where it would only display the first elements, which is kind of silly, no? Do not interpret this remark as an argument against your patch, I just wanted to state that arrays with strange bound values have several problems... Pierre Muller Pascal language maintainer. > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Joel Brobecker > Sent: Wednesday, January 09, 2008 7:34 AM > To: gdb-patches@sourceware.org > Subject: [RFA] Add handling of null Ada arrays > > Hello, > > In Ada, arrays can be empty by setting the high bound to a smaller > value than the low bound. For instance, a typical declaration would be: > > type Empty_Array is array (1 .. 0) of Integer; > > The attached patch fixes a bug when trying to print a variable of such > a type: > > (gdb) print my_table > object size is larger than varsize-limit > > The problem is that we compute the array length using the bounds from > the index type without checking first that the high bound is larger or > equal to the small bound. There were a couple of places were we did > that, so we made some adjustments there. > > 2008-01-09 Joel Brobecker > > * gdbtypes.c (create_array_type): Add handling of null Ada > arrays. > (check_typedef): Likewise. > > I was able to write a testcase too: > > 2008-01-09 Joel Brobecker > > * gdb.ada/null_array: New test program. > * gdb.ada/null_array.exp: New testcase. > > Tested on x86-linux, no regression. > OK to commit? > > Thanks, > -- > Joel