From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24232 invoked by alias); 9 Jan 2008 17:17:46 -0000 Received: (qmail 24215 invoked by uid 22791); 9 Jan 2008 17:17:45 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 17:17:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 159AC2A9679; Wed, 9 Jan 2008 12:17:24 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Rp959Jg3REed; Wed, 9 Jan 2008 12:17:24 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3BD3C2A9667; Wed, 9 Jan 2008 12:17:23 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id CB63EE7ACB; Wed, 9 Jan 2008 09:17:15 -0800 (PST) Date: Wed, 09 Jan 2008 17:17:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Add handling of null Ada arrays Message-ID: <20080109171715.GD21281@adacore.com> References: <20080109063342.GE20580@adacore.com> <000401c852a1$0bdb1aa0$23914fe0$@u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401c852a1$0bdb1aa0$23914fe0$@u-strasbg.fr> User-Agent: Mutt/1.4.2.2i 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/msg00198.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... That's ... strange :). > Of course you cannot allocate a pointer to such a type > directly, and it would eat up a lot of memory space. Right. If you did that in Ada, you would immediately trigger an exception. In fact, I believe that GNAT detects static cases like this and replaces the code with an exception raise. How does the above work in Pascal? If the program hasn't "allocated a pointer to such type", does it mean that the size of the array is dynamic and grown as needed? I think it's be interesting to understand how it works underneath if we want to improve the situation for Pascal too. On my end, my Pascal days are long behind me (I think the last time I wrote some Pascal was in 92 or 93), but I thought that Pascal arrays were allocated when declared and that the bounds could not be changed after... > 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? We had the exact same issue with Ada, actually. Paul Hilfinger fixed it for us. The good news is that my patch should avoid GDB trying to allocate 0xffffffff bytes for your array, which usually leads to a debugger crash ;-). -- Joel