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:
parent
27dee630aa
commit
dbc98a8b6e
12 changed files with 127 additions and 96 deletions
|
@ -572,19 +572,20 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
|
|||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, ")");
|
||||
{
|
||||
LONGEST low_bound, high_bound;
|
||||
|
||||
fprintf_filtered (stream, "[");
|
||||
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
|
||||
&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|
||||
fprintf_filtered (stream, "%d",
|
||||
(TYPE_LENGTH (type)
|
||||
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
|
||||
fprintf_filtered (stream, "]");
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, ")");
|
||||
|
||||
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show,
|
||||
0, 0);
|
||||
fprintf_filtered (stream, "[");
|
||||
if (get_array_bounds (type, &low_bound, &high_bound))
|
||||
fprintf_filtered (stream, "%d", (int) (high_bound - low_bound + 1));
|
||||
fprintf_filtered (stream, "]");
|
||||
|
||||
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show,
|
||||
0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_MEMBERPTR:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue