binutils-gdb/gdb/testsuite/gdb.ada
Joel Brobecker 8a48ac9579 wrong dimension found in ada-lang.c:ada_array_bound_from_type
This function has the following code:

  elt_type = type;
  for (i = n; i > 1; i--)
    elt_type = TYPE_TARGET_TYPE (type);

For multi-dimension arrays, the code above tries to find the array
type corresponding to the dimension we're trying to inspect.
The problem is that, past the second dimension, the loop does
nothing other than repeat the first iteration. There is a little
thinko where it got the TYPE_TARGET_TYPE of TYPE instead of ELT_TYPE!

To my surprise, I was unable to produce an Ada exemple that demonstrated
the problem.  That's because the examples I created all trigger a parallel
___XA type which we then use in place of the ELT_TYPE in order to
determine the bounds - see the code that immediately follows our
loop above:

    index_type_desc = ada_find_parallel_type (type, "___XA");
    ada_fixup_array_indexes_type (index_type_desc);
    if (index_type_desc != NULL)
    [...]

So, in order to avoid depending on an Ada example where the compiler
can potentially decide one way or the other, I decided to use an
artificial example, written in C. With ...

  int multi[1][2][3];

... forcing the language to Ada, and trying to print the 'last,
we get:

    (gdb) p multi'last(1)
    $1 = 0
    (gdb) p multi'last(2)
    $2 = 1
    (gdb) p multi'last(3)
    $3 = 1   <<<---  This should be 2!

Additionally, I noticed that a couple of check_typedef's were missing.
This patch adds them. And since the variable in question only gets
used within an "else" block, I moved the variable declaration and
use inside that block - making it clear what the scope of the variable
is.

gdb/ChangeLog:

        * ada-lang.c (ada_array_bound_from_type): Move the declaration
        and assignment of variable "elt_type" inside the else block
        where it is used.  Add two missing check_typedef calls.
        Fix bug where we got TYPE's TYPE_TARGET_TYPE, where in fact
        we really wanted to get ELT_TYPE's TYPE_TARGET_TYPE.

gdb/testsuite/ChangeLog:

        * gdb.ada/arraydim: New testcase.
2013-12-13 09:55:24 +01:00
..
aliased_array Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_bounds Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_return Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_subscript_addr Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arraydim wrong dimension found in ada-lang.c:ada_array_bound_from_type 2013-12-13 09:55:24 +01:00
arrayidx Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arrayparam Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arrayptr [testsuite/Ada] Add testing of access to packed arrays. 2013-07-10 00:35:01 +00:00
atomic_enum Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bad-task-bp-keyword Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_enum_homonym Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_on_var Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_range_type Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_reset Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
call_pn Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
catch_ex Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
char_enum Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
char_param Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
complete Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cond_lang Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
dot_all Ada: Reserved word "all" should not need to be spelled in lowercase. 2013-12-03 16:04:26 +04:00
dyn_loc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
enum_idx_packed Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
exec_changed Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expr_delims Allow 'thread' to be used as a variable name in expressions. 2013-03-12 09:03:11 +00:00
exprs Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fixed_cmp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fixed_points Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
float_param [dwarf] Mark all functions as prototyped except C functions. 2013-05-20 09:45:13 +00:00
formatted_ref Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
frame_args Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fullname_bp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fun_addr Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fun_in_declare Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
funcall_param Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
homonym Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
info_exc gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name. 2013-11-16 06:45:57 +04:00
info_locals_renaming Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
int_deref Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
interface Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
iwide Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
lang_switch Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mi_catch_ex Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mi_ex_cond Dandling memory pointers in Ada catchpoints with GDB/MI. 2013-11-11 19:19:07 +04:00
mi_exc_info gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name. 2013-11-16 06:45:57 +04:00
mi_task_arg Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mi_task_info Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mod_from_name Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nested Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
null_array Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
null_record Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
O2_float_param Fix DW_OP_GNU_regval_type with FP registers 2013-11-14 22:38:48 -05:00
operator_bp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
optim_drec Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
packed_array Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
packed_tagged Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
print_chars Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptr_typedef Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype_field Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype_tagged_param Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
py_range Fix int() builtin with range type gdb.Value objects. 2013-11-19 06:44:40 +04:00
rdv_wait Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rec_return Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref_param Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref_tick_size Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
same_enum Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
set_pckd_arr_elt Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
set_wstr Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
small_reg_param Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
start Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
str_ref_cmp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
sym_print_name Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
taft_type Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tagged Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tagged_not_init Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
task_bp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tasks Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tick_last_segv Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
type_coercion Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
unc_arr_ptr_in_var_rec Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
uninitialized_vars strip off +x bits on non-executable/script files 2013-12-07 02:03:03 -05:00
variant_record_packed_array Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
watch_arg Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
whatis_array_val Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
widewide Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
win_fu_syms Ignore __fu<digits>__ symbols from COFF symbol tables 2013-03-29 02:04:15 +00:00
aliased_array.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_bounds.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_return.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
array_subscript_addr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arraydim.exp wrong dimension found in ada-lang.c:ada_array_bound_from_type 2013-12-13 09:55:24 +01:00
arrayidx.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
arrayparam.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arrayptr.exp [testsuite/Ada] Add testing of access to packed arrays. 2013-07-10 00:35:01 +00:00
assign_1.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
atomic_enum.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bad-task-bp-keyword.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
boolean_expr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_enum_homonym.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_on_var.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_range_type.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bp_reset.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
call_pn.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
catch_ex.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
char_enum.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
char_param.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
complete.exp gdb.ada/complete.exp: Fix FIXME. 2013-05-16 10:13:33 +00:00
cond_lang.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
dot_all.exp Ada: Reserved word "all" should not need to be spelled in lowercase. 2013-12-03 16:04:26 +04:00
dyn_loc.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
enum_idx_packed.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
exec_changed.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expr_delims.exp Allow 'thread' to be used as a variable name in expressions. 2013-03-12 09:03:11 +00:00
exprs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fixed_cmp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fixed_points.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
float_param.exp [dwarf] Mark all functions as prototyped except C functions. 2013-05-20 09:45:13 +00:00
formatted_ref.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
frame_args.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fullname_bp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fun_addr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fun_in_declare.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
funcall_param.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gnat_ada.gpr Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
homonym.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
info_exc.exp gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name. 2013-11-16 06:45:57 +04:00
info_locals_renaming.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
info_types.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
info_types.exp simple test suite fix in gdb.ada 2013-07-16 18:52:18 +00:00
int_deref.exp Set language for Ada minimal symbols. 2013-12-10 12:16:47 +01:00
interface.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
iwide.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
lang_switch.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
Makefile.in * Makefile.in (clean): Remove Fission .dwo and .dwp files. 2012-05-17 19:03:59 +00:00
mi_catch_ex.exp Adjust gdb.ada/mi_catch_ex.exp to use GDB/MI catch commands... 2013-10-11 13:49:36 +00:00
mi_ex_cond.exp Dandling memory pointers in Ada catchpoints with GDB/MI. 2013-11-11 19:19:07 +04:00
mi_exc_info.exp gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique exception name. 2013-11-16 06:45:57 +04:00
mi_task_arg.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mi_task_info.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mod_from_name.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nested.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
null_array.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
null_record.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
O2_float_param.exp Fix DW_OP_GNU_regval_type with FP registers 2013-11-14 22:38:48 -05:00
operator_bp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
optim_drec.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
packed_array.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
packed_tagged.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
print_chars.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
print_pc.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptr_typedef.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype_arith_binop.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype_field.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype_tagged_param.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
py_range.exp Fix int() builtin with range type gdb.Value objects. 2013-11-19 06:44:40 +04:00
rdv_wait.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rec_return.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref_param.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref_tick_size.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
same_enum.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
set_pckd_arr_elt.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
set_wstr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
small_reg_param.exp Fix FAIL: gdb.ada/small_reg_param.exp: continue to call_me 2013-07-10 00:10:37 +00:00
start.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
str_ref_cmp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
sym_print_name.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
taft_type.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tagged.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tagged_not_init.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
task_bp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tasks.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
tick_last_segv.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
type_coercion.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
unc_arr_ptr_in_var_rec.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
uninitialized_vars.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
variant_record_packed_array.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
watch_arg.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
whatis_array_val.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
widewide.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
win_fu_syms.exp Ignore __fu<digits>__ symbols from COFF symbol tables 2013-03-29 02:04:15 +00:00