From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>,
<gdb-patches@sourceware.org>
Subject: RE: [RFA] Add handling of null Ada arrays
Date: Wed, 09 Jan 2008 09:22:00 -0000 [thread overview]
Message-ID: <000401c852a1$0bdb1aa0$23914fe0$@u-strasbg.fr> (raw)
In-Reply-To: <20080109063342.GE20580@adacore.com>
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 <brobecker@adacore.com>
>
> * 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 <brobecker@adacore.com>
>
> * 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
next prev parent reply other threads:[~2008-01-09 9:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-09 6:34 Joel Brobecker
2008-01-09 9:22 ` Pierre Muller [this message]
2008-01-09 17:17 ` Joel Brobecker
2008-01-09 19:05 ` Jim Blandy
2008-01-09 12:47 ` Daniel Jacobowitz
2008-01-09 17:07 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000401c852a1$0bdb1aa0$23914fe0$@u-strasbg.fr' \
--to=muller@ics.u-strasbg.fr \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox