This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog ada-lang.c testsuite/ChangeL ...
- From: brobecke at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 29 Feb 2012 19:34:40 -0000
- Subject: src/gdb ChangeLog ada-lang.c testsuite/ChangeL ...
CVSROOT: /cvs/src
Module name: src
Changes by: brobecke@sourceware.org 2012-02-29 19:34:40
Modified files:
gdb : ChangeLog ada-lang.c
gdb/testsuite : ChangeLog
gdb/testsuite/gdb.ada: arrayidx.exp
Added files:
gdb/testsuite/gdb.ada: enum_idx_packed.exp
gdb/testsuite/gdb.ada/enum_idx_packed: foo.adb pck.adb pck.ads
Log message:
[Ada] print packed arrays indexed by enumerated type
Consider the following declarations (a packed array indexed by an
enumerated type):
type Color is (Black, Red, Green, Blue, White);
type Full_Table is array (Color) of Boolean;
pragma Pack (Full_Table);
Full : Full_Table := (False, True, False, True, False);
GDB is unable to print the index values correctly. It prints the
enumeration's underlying value instead of the enumeration name:
(gdb) p full
$1 = (0 => false, true, false, true, false)
(gdb) p full'first
$2 = 0
And yet, it is capable of printing the correct type description:
(gdb) ptype full
type = array (black .. white) of boolean <packed: 1-bit elements>
To get to the real index type, one has to follow the parallel XA type.
We already do this for normal arrays. We can do it for this packed
array as well.
gdb/ChangeLog:
* ada-lang.c (constrained_packed_array_type): If there is a
parallel XA type, use it to determine the array index type.
gdb/testsuite/ChangeLog:
* gdb.ada/arrayidx.exp: Adjust expected output for p_one_two_three.
* gdb.ada/enum_idx_packed: New testcase.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13883&r2=1.13884
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.340&r2=1.341
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3103&r2=1.3104
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/enum_idx_packed.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/arrayidx.exp.diff?cvsroot=src&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/enum_idx_packed/pck.adb.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads.diff?cvsroot=src&r1=NONE&r2=1.1