diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 12 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/dyn_stride.exp | 3 |
4 files changed, 21 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c25683c428..1ab2a892352 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2018-01-02 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (ada_value_slice_from_ptr): Take array stride into + account when creating the array type of the slice. + (ada_value_slice): Likewise. + +2018-01-02 Joel Brobecker <brobecker@adacore.com> + * gdbtypes.h (enum dynamic_prop_node_kind) <DYN_PROP_BYTE_STRIDE>: New enum value. (create_array_type_with_stride): Add byte_stride_prop parameter. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 208dda42ded..851e69ac4ba 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2910,8 +2910,10 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type, struct type *base_index_type = TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type0)); struct type *index_type = create_static_range_type (NULL, base_index_type, low, high); - struct type *slice_type = - create_array_type (NULL, TYPE_TARGET_TYPE (type0), index_type); + struct type *slice_type = create_array_type_with_stride + (NULL, TYPE_TARGET_TYPE (type0), index_type, + get_dyn_prop (DYN_PROP_BYTE_STRIDE, type0), + TYPE_FIELD_BITSIZE (type0, 0)); int base_low = ada_discrete_type_low_bound (TYPE_INDEX_TYPE (type0)); LONGEST base_low_pos, low_pos; CORE_ADDR base; @@ -2938,8 +2940,10 @@ ada_value_slice (struct value *array, int low, int high) struct type *base_index_type = TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (type)); struct type *index_type = create_static_range_type (NULL, TYPE_INDEX_TYPE (type), low, high); - struct type *slice_type = - create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type); + struct type *slice_type = create_array_type_with_stride + (NULL, TYPE_TARGET_TYPE (type), index_type, + get_dyn_prop (DYN_PROP_BYTE_STRIDE, type), + TYPE_FIELD_BITSIZE (type, 0)); LONGEST low_pos, high_pos; if (!discrete_position (base_index_type, low, &low_pos) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 06f0f4735f7..9ef8dd1be5f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2018-01-02 Joel Brobecker <brobecker@adacore.com> + * gdb.ada/dyn_stride.exp: Add slice test. + +2018-01-02 Joel Brobecker <brobecker@adacore.com> + * gdb.ada/dyn_stride: New testcase. 2017-12-27 Stafford Horne <shorne@gmail.com> diff --git a/gdb/testsuite/gdb.ada/dyn_stride.exp b/gdb/testsuite/gdb.ada/dyn_stride.exp index 33723d46c19..0267ca192bf 100644 --- a/gdb/testsuite/gdb.ada/dyn_stride.exp +++ b/gdb/testsuite/gdb.ada/dyn_stride.exp @@ -36,3 +36,6 @@ gdb_test "print A1(2)" \ gdb_test "print A1(3)" \ "\\(i => 2, s => \"AB\"\\)" + +gdb_test "print A1(1..3)" \ + "\\(\\(i => 0, s => \"\"\\), \\(i => 1, s => \"A\"\\), \\(i => 2, s => \"AB\"\\)\\)" |