forked from Imagelibrary/binutils-gdb
gdb:
* dwarf2read.c (read_array_type): Read the DW_AT_byte_size from the DIE and set the length of the type. * gdbtypes.h (get_array_bounds): Move here from valprint.h. * gdbtypes.c (get_array_bounds): Move here from valprint.c and return 0 if the corresponding bounds of the type are undefined. * valprint.h (get_array_bounds): Move declaration to gdbtypes.h. * valprint.c (get_array_bounds): Move implementation to gdbtypes.c. (val_print_array_elements): Use get_array_bounds to compute the number of array elements instead of dividing the length of the array by the length of the element types. * valarith.c (vector_binop): Likewise. * valops.c (value_cast): Likewise. * c-valprint.c (c_val_print): Likewise. * c-typeprint.c (c_type_print_varspec_suffix): Likewise. gdb/testsuite: * gdb.base/gnu_vector.exp: Adjust expect messages.
This commit is contained in:
@@ -7194,6 +7194,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
if (attr)
|
||||
make_vector_type (type);
|
||||
|
||||
/* The DIE may have DW_AT_byte_size set. For example an OpenCL
|
||||
implementation may choose to implement triple vectors using this
|
||||
attribute. */
|
||||
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
|
||||
if (attr)
|
||||
{
|
||||
if (DW_UNSND (attr) >= TYPE_LENGTH (type))
|
||||
TYPE_LENGTH (type) = DW_UNSND (attr);
|
||||
else
|
||||
complaint (&symfile_complaints, _("\
|
||||
DW_AT_byte_size for array type smaller than the total size of elements"));
|
||||
}
|
||||
|
||||
name = dwarf2_name (die, cu);
|
||||
if (name)
|
||||
TYPE_NAME (type) = name;
|
||||
|
||||
Reference in New Issue
Block a user