diff options
author | Sanimir Agovic <sanimir.agovic@intel.com> | 2013-10-14 08:36:13 +0100 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-04-14 09:15:33 -0700 |
commit | 9f1f738adae6b28c4f7db7e3607b4c224f1f7612 (patch) | |
tree | a1a19486f98f1d2566940b89b9a2bf0ab03574a5 /gdb/valops.c | |
parent | 3c8452d46ac23d455c30438d0885a738e02b56e1 (diff) | |
download | gdb-9f1f738adae6b28c4f7db7e3607b4c224f1f7612.zip gdb-9f1f738adae6b28c4f7db7e3607b4c224f1f7612.tar.gz gdb-9f1f738adae6b28c4f7db7e3607b4c224f1f7612.tar.bz2 |
vla: update type from newly created value
Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.
gdb/ChangeLog
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 46e2639..a155379 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -266,6 +266,7 @@ value_cast_structs (struct type *type, struct value *v2) { v = value_full_object (v2, real_type, full, top, using_enc); v = value_at_lazy (real_type, value_address (v)); + real_type = value_type (v); /* We might be trying to cast to the outermost enclosing type, in which case search_struct_field won't work. */ @@ -801,6 +802,7 @@ value_dynamic_cast (struct type *type, struct value *arg) return value_at_lazy (type, addr); tem = value_at (type, addr); + type = value_type (tem); /* The first dynamic check specified in 5.2.7. */ if (is_public_ancestor (arg_type, TYPE_TARGET_TYPE (resolved_type))) @@ -1320,6 +1322,7 @@ address_of_variable (struct symbol *var, const struct block *b) Lazy evaluation pays off here. */ val = value_of_variable (var, b); + type = value_type (val); if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) || TYPE_CODE (type) == TYPE_CODE_FUNC) @@ -1568,6 +1571,7 @@ value_ind (struct value *arg1) (value_as_address (arg1) - value_pointed_to_offset (arg1))); + enc_type = value_type (arg2); return readjust_indirect_value_type (arg2, enc_type, base_type, arg1); } |