+2014-09-10 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (ada_array_bound): If ARR is a TYPE_CODE_PTR,
+ dereference it first. Use value_enclosing_type instead of
+ value_type.
+ (ada_array_length): Likewise.
+
2014-09-10 Joel Brobecker <brobecker@adacore.com>
* ada-lang.c (ada_value_ptr_subscript): Remove parameter "type".
static LONGEST
ada_array_bound (struct value *arr, int n, int which)
{
- struct type *arr_type = value_type (arr);
+ struct type *arr_type;
+
+ if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR)
+ arr = value_ind (arr);
+ arr_type = value_enclosing_type (arr);
if (ada_is_constrained_packed_array_type (arr_type))
return ada_array_bound (decode_constrained_packed_array (arr), n, which);
static LONGEST
ada_array_length (struct value *arr, int n)
{
- struct type *arr_type = ada_check_typedef (value_type (arr));
+ struct type *arr_type;
+
+ if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR)
+ arr = value_ind (arr);
+ arr_type = value_enclosing_type (arr);
if (ada_is_constrained_packed_array_type (arr_type))
return ada_array_length (decode_constrained_packed_array (arr), n);
gdb_test "print foo.three_ptr.all(3)" \
" = 3"
+gdb_test "print foo.three_ptr.all'first" \
+ " = 1"
+
+gdb_test "print foo.three_ptr.all'last" \
+ " = 3"
+
+gdb_test "print foo.three_ptr.all'length" \
+ " = 3"
+
# foo.three_ptr
gdb_test "print foo.three_ptr(1)" \
gdb_test "print foo.three_ptr(3)" \
" = 3"
+gdb_test "print foo.three_ptr'first" \
+ " = 1"
+
+gdb_test "print foo.three_ptr'last" \
+ " = 3"
+
+gdb_test "print foo.three_ptr'length" \
+ " = 3"
+
# foo.three_ptr_tdef.all
gdb_test "print foo.three_ptr_tdef.all" \
gdb_test "print foo.three_ptr_tdef.all(3)" \
" = 3"
+gdb_test "print foo.three_ptr_tdef.all'first" \
+ " = 1"
+
+gdb_test "print foo.three_ptr_tdef.all'last" \
+ " = 3"
+
+gdb_test "print foo.three_ptr_tdef.all'length" \
+ " = 3"
+
# foo.three_ptr_tdef
gdb_test "print foo.three_ptr_tdef(1)" \
gdb_test "print foo.three_ptr_tdef(3)" \
" = 3"
+gdb_test "print foo.three_ptr_tdef'first" \
+ " = 1"
+
+gdb_test "print foo.three_ptr_tdef'last" \
+ " = 3"
+
+gdb_test "print foo.three_ptr_tdef'length" \
+ " = 3"
+
# foo.five_ptr.all
gdb_test "print foo.five_ptr.all" \
gdb_test "print foo.five_ptr.all(6)" \
" = 34"
+gdb_test "print foo.five_ptr.all'first" \
+ " = 2"
+
+gdb_test "print foo.five_ptr.all'last" \
+ " = 6"
+
+gdb_test "print foo.five_ptr.all'length" \
+ " = 5"
+
# foo.five_ptr
gdb_test "print foo.five_ptr(2)" \
gdb_test "print foo.five_ptr(6)" \
" = 34"
+gdb_test "print foo.five_ptr'first" \
+ " = 2"
+
+gdb_test "print foo.five_ptr'last" \
+ " = 6"
+
+gdb_test "print foo.five_ptr'length" \
+ " = 5"
+
# foo.five_ptr_tdef.all
gdb_test "print foo.five_ptr_tdef.all" \
gdb_test "print foo.five_ptr_tdef.all(6)" \
" = 34"
+gdb_test "print foo.five_ptr_tdef.all'first" \
+ " = 2"
+
+gdb_test "print foo.five_ptr_tdef.all'last" \
+ " = 6"
+
+gdb_test "print foo.five_ptr_tdef.all'length" \
+ " = 5"
+
# foo.five_ptr_tdef
gdb_test "print foo.five_ptr_tdef(2)" \
gdb_test "print foo.five_ptr_tdef(6)" \
" = 34"
+
+gdb_test "print foo.five_ptr_tdef'first" \
+ " = 2"
+
+gdb_test "print foo.five_ptr_tdef'last" \
+ " = 6"
+
+gdb_test "print foo.five_ptr_tdef'length" \
+ " = 5"