aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-07-10 00:35:01 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-07-10 00:35:01 +0000
commit51b864269362341b80f9953c82c90520de51a0d8 (patch)
tree603cf07c552c66ccc2d06d34f9345e10212bf3fa /gdb
parenteca07816f8f4c9cb081123a8534a481b416d1add (diff)
downloadgdb-51b864269362341b80f9953c82c90520de51a0d8.zip
gdb-51b864269362341b80f9953c82c90520de51a0d8.tar.gz
gdb-51b864269362341b80f9953c82c90520de51a0d8.tar.bz2
[testsuite/Ada] Add testing of access to packed arrays.
This patch adds some tests that evidence a regression fixed by the following patch from Pedro Alves: [PATCH] ada-lang.c:coerce_unspec_val_to_type: Preserve laziness http://www.sourceware.org/ml/gdb-patches/2013-07/msg00178.html gdb/testsuite/ChangeLog: * gdb.ada/arrayptr/foo.adb: Add some code defining an access to a packed array. * gdb.ada/arrayptr.exp: Add a few tests using that new access to packed array.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr.exp6
-rw-r--r--gdb/testsuite/gdb.ada/arrayptr/foo.adb11
2 files changed, 17 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/arrayptr.exp b/gdb/testsuite/gdb.ada/arrayptr.exp
index bfa36fd..8171db7 100644
--- a/gdb/testsuite/gdb.ada/arrayptr.exp
+++ b/gdb/testsuite/gdb.ada/arrayptr.exp
@@ -45,3 +45,9 @@ gdb_test "print arr_ptr (3..4)" "= \\(3 => 23, 24\\)"
gdb_test "ptype string_access" "= access array \\(<>\\) of character"
+gdb_test "print pa_ptr.all" \
+ " = \\(10, 20, 30, 40, 50, 60, 62, 63, -23, 42\\)"
+
+gdb_test "print pa_ptr(3)" " = 30"
+
+gdb_test "print pa_ptr.all(3)" " = 30"
diff --git a/gdb/testsuite/gdb.ada/arrayptr/foo.adb b/gdb/testsuite/gdb.ada/arrayptr/foo.adb
index aa66fbd..e414db1 100644
--- a/gdb/testsuite/gdb.ada/arrayptr/foo.adb
+++ b/gdb/testsuite/gdb.ada/arrayptr/foo.adb
@@ -26,8 +26,19 @@ procedure Foo is
type Little_Array_Ptr is access all Little_Array;
Arr_Ptr: Little_Array_Ptr :=
new Little_Array'(21, 22, 23, 24, 25, 26, 27, 28, 29, 30);
+
+ -- Same as above, but with a packed array.
+ type Small is range -64 .. 63;
+ for Small'Size use 7;
+ type Packed_Array is array (1..10) of Small;
+ pragma Pack (Packed_Array);
+
+ type Packed_Array_Ptr is access Packed_Array;
+ PA_Ptr : Packed_Array_Ptr
+ := new Packed_Array'(10, 20, 30, 40, 50, 60, 62, 63, -23, 42);
begin
Do_Nothing (String_P'Address); -- STOP
Do_Nothing (Null_String'Address);
Do_Nothing (Arr_Ptr'Address);
+ Do_Nothing (PA_Ptr'Address);
end Foo;