binutils-gdb/gdb/testsuite/gdb.ada
Joel Brobecker 8776cfe971 [varobj] false type-changed status for reference to Ada array
Given the following variable...

   BT : Bounded := New_Bounded (Low => 1, High => 3);

... where type Bounded is defined as a simple unconstrained array:

   type Bounded is array (Integer range <>) of Integer;

Creating a varobj for that variable, and immediately asking for
varobj updates, GDB says that our varobj changed types!

    (gdb)
    -var-create bt * bt
    ^done,name="bt",numchild="3",value="[3]",type="<ref> array (1 .. 3) of integer",has_more="0"
    (gdb)
    -var-update 1 *
    ^done,changelist=[{name="bt",value="[3]",in_scope="true",type_changed="true",new_type="<ref> array (1 .. 3) of integer",new_num_children="3",has_more="0"}]

The expected output for the -var-update command is, in this case:

    (gdb)
    -var-update 1 *
    ^done,changelist=[]

The problem occurs because the ada-varobj module does not handle
references, and while the references gets stripped when the varobj
gets created, it doesn't when computing varobj updates.

More specifically, when creating the varobj, varobj_create creates
a new value which is a reference to a TYPE_CODE_ARRAY. It then calls
install_new_value which calls coerce_ref with the following comment:

    /* We are not interested in the address of references, and given
       that in C++ a reference is not rebindable, it cannot
       meaningfully change.  So, get hold of the real value.  */
    if (value)
      value = coerce_ref (value);

This leaves the varobj's type component still a ref, while
the varobj's value is now our array, without the ref. This explains
why the "value" field in the varobj indicates an array with 3 elements
"[3]" while the "type" field shows a ref to an array. Generally
speaking, most users have said that showing the ref was a useful
piece of information, so this patch is not touching this part.

Next, when the user issues the -var-update request, varobj_update
calls value_of_root to compute the varobj's new value as well as
determine whether the value's type has changed or not. What happens
in a nutshell is that it calls value_of_root_1 (which re-evaluates
the expression and returns the corresponding new value), finds that
the new value is not NULL, and thus asks whether it has mutated:

    else if (varobj_value_has_mutated (var, value, value_type (value)))

This then indirectly delegates the determination to the language-specific
callback, which fails, because it does not handle references.

This patch fixes the issue by adjusting varobj_value_has_mutated to
expect references, and strip them when seen. This allows the various
language-specific implementations to remain unaware of references.

gdb/ChangeLog:

        * varobj.c (varobj_value_has_mutated): If NEW_VALUE is
        a reference, strip the reference layer before calling
        the lang_ops value_has_mutated callback.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_dyn_arr: New testcase.
2014-03-28 06:22:24 -07:00
..
O2_float_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
aliased_array Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_bounds Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_char_idx Try printing array range using the name of its index type 2014-01-27 08:27:21 +04:00
array_return Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_subscript_addr Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arraydim Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayidx Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayparam Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayptr Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
atomic_enum Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bad-task-bp-keyword Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_enum_homonym Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_on_var Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_range_type Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_reset Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
call_pn Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
catch_ex Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
char_enum Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
char_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
complete Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
cond_lang Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dot_all Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dyn_loc Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
enum_idx_packed Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
exec_changed Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
expr_delims Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
exprs Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fixed_cmp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fixed_points Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
float_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
formatted_ref Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
frame_args Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fullname_bp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fun_addr Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fun_in_declare Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
funcall_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
homonym Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_exc Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_locals_renaming Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
int_deref Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
interface Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
iwide Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
lang_switch Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_catch_ex Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_dyn_arr [varobj] false type-changed status for reference to Ada array 2014-03-28 06:22:24 -07:00
mi_ex_cond Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_exc_info Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_interface varobj/Ada: Missing children for interface-wide tagged types 2014-01-07 08:29:04 +04:00
mi_task_arg Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_task_info Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mod_from_name Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
nested Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
null_array Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
null_record Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
operator_bp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
optim_drec Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
packed_array Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
packed_tagged Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pckd_arr_ren [testsuite/Ada] New testcase for packed array renaming. 2014-03-17 08:45:55 -07:00
pp-rec-component Ada: Fix missing call to pretty-printer for fields of records. 2014-01-07 08:17:40 +04:00
print_chars Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptr_typedef Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptype_field Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptype_tagged_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
py_range Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
rdv_wait Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
rec_return Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ref_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ref_tick_size Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
same_enum Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
set_pckd_arr_elt Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
set_wstr Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
small_reg_param Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
start Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
str_ref_cmp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
sym_print_name Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
taft_type Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tagged Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tagged_access [Ada] Full view of tagged type with ptype 2014-03-10 14:40:35 +01:00
tagged_not_init Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
task_bp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tasks Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tick_last_segv Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tick_length_array_enum_idx Wrong type for 'Length result. 2014-02-10 13:15:43 +04:00
type_coercion Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unc_arr_ptr_in_var_rec Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
uninitialized_vars Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
variant_record_packed_array Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watch_arg Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
whatis_array_val Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
widewide Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
win_fu_syms Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Makefile.in * Makefile.in (clean): Remove Fission .dwo and .dwp files. 2012-05-17 19:03:59 +00:00
O2_float_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
aliased_array.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_bounds.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_char_idx.exp Try printing array range using the name of its index type 2014-01-27 08:27:21 +04:00
array_return.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
array_subscript_addr.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arraydim.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayidx.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayparam.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
arrayptr.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
assign_1.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
atomic_enum.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bad-task-bp-keyword.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
boolean_expr.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_enum_homonym.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_on_var.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_range_type.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_reset.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
call_pn.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
catch_ex.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
char_enum.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
char_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
complete.exp Skip tests on completion and readline when readline lib isn't used 2014-03-26 21:11:08 +08:00
cond_lang.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dot_all.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dyn_loc.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
enum_idx_packed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
exec_changed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
expr_delims.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
exprs.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fixed_cmp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fixed_points.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
float_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
formatted_ref.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
frame_args.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fullname_bp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fun_addr.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fun_in_declare.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
funcall_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
gnat_ada.gpr Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
homonym.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_exc.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_locals_renaming.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_types.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info_types.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
int_deref.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
interface.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
iwide.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
lang_switch.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_catch_ex.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_dyn_arr.exp [varobj] false type-changed status for reference to Ada array 2014-03-28 06:22:24 -07:00
mi_ex_cond.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_exc_info.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_interface.exp varobj/Ada: Missing children for interface-wide tagged types 2014-01-07 08:29:04 +04:00
mi_task_arg.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mi_task_info.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
mod_from_name.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
nested.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
null_array.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
null_record.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
operator_bp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
optim_drec.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
packed_array.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
packed_tagged.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pckd_arr_ren.exp [testsuite/Ada] New testcase for packed array renaming. 2014-03-17 08:45:55 -07:00
pp-rec-component.exp Remove path from gdb.ada/pp-rec-component.exp "source" test 2014-01-10 07:57:11 +04:00
pp-rec-component.py Ada: Fix missing call to pretty-printer for fields of records. 2014-01-07 08:17:40 +04:00
print_chars.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
print_pc.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptr_typedef.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptype_arith_binop.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptype_field.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ptype_tagged_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
py_range.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
rdv_wait.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
rec_return.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ref_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ref_tick_size.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
same_enum.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
set_pckd_arr_elt.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
set_wstr.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
small_reg_param.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
start.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
str_ref_cmp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
sym_print_name.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
taft_type.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tagged.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tagged_access.exp [Ada] Full view of tagged type with ptype 2014-03-10 14:40:35 +01:00
tagged_not_init.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
task_bp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tasks.exp Multiple Ada task-specific breakpoints at the same address. 2014-02-26 14:22:33 +00:00
tick_last_segv.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tick_length_array_enum_idx.exp Wrong type for 'Length result. 2014-02-10 13:15:43 +04:00
type_coercion.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
unc_arr_ptr_in_var_rec.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
uninitialized_vars.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
variant_record_packed_array.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watch_arg.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
whatis_array_val.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
widewide.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
win_fu_syms.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00