aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorKen Werner <ken.werner@de.ibm.com>2010-11-03 14:21:58 +0000
committerKen Werner <ken.werner@de.ibm.com>2010-11-03 14:21:58 +0000
commitdbc98a8b6eb97ea7315e04103cdfec5add47f3c4 (patch)
tree767338cf124ded0f5c63ea6521f6a72b84095488 /gdb/dwarf2read.c
parent27dee630aae66dd61eb20135e7b8384088b1a496 (diff)
downloadgdb-dbc98a8b6eb97ea7315e04103cdfec5add47f3c4.zip
gdb-dbc98a8b6eb97ea7315e04103cdfec5add47f3c4.tar.gz
gdb-dbc98a8b6eb97ea7315e04103cdfec5add47f3c4.tar.bz2
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e613d90..a91f14a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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;