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/ada-lang.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/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9544758..e268eba 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2406,6 +2406,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj)) { v = value_at (type, value_address (obj)); + type = value_type (v); bytes = (unsigned char *) alloca (len); read_memory (value_address (v) + offset, bytes, len); } @@ -7888,6 +7889,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, size first before creating the value. */ check_size (rtype); dval = value_from_contents_and_address (rtype, valaddr, address); + rtype = value_type (dval); } else dval = dval0; @@ -7990,7 +7992,10 @@ ada_template_to_fixed_record_type_1 (struct type *type, off = TYPE_FIELD_BITPOS (rtype, variant_field); if (dval0 == NULL) - dval = value_from_contents_and_address (rtype, valaddr, address); + { + dval = value_from_contents_and_address (rtype, valaddr, address); + rtype = value_type (dval); + } else dval = dval0; @@ -8131,7 +8136,10 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, return type; if (dval0 == NULL) - dval = value_from_contents_and_address (type, valaddr, address); + { + dval = value_from_contents_and_address (type, valaddr, address); + type = value_type (dval); + } else dval = dval0; @@ -8429,6 +8437,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr, value_from_contents_and_address (fixed_record_type, valaddr, address); + fixed_record_type = value_type (obj); if (real_type != NULL) return to_fixed_record_type (real_type, NULL, |