This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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

Attachment: null_array.diff
Description: Text document

Attachment: null_array-tc.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]