forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
committed by
Joel Brobecker
parent
3c8452d46a
commit
9f1f738ada
@@ -443,6 +443,7 @@ cp_print_value_fields_rtti (struct type *type,
|
||||
/* Ugh, we have to convert back to a value here. */
|
||||
value = value_from_contents_and_address (type, valaddr + offset,
|
||||
address + offset);
|
||||
type = value_type (value);
|
||||
/* We don't actually care about most of the result here -- just
|
||||
the type. We already have the correct offset, due to how
|
||||
val_print was initially called. */
|
||||
@@ -545,6 +546,7 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||
base_val = value_from_contents_and_address (baseclass,
|
||||
buf,
|
||||
address + boffset);
|
||||
baseclass = value_type (base_val);
|
||||
thisoffset = 0;
|
||||
boffset = 0;
|
||||
thistype = baseclass;
|
||||
|
||||
Reference in New Issue
Block a user