diff options
author | Ken Werner <ken.werner@de.ibm.com> | 2010-11-03 14:21:58 +0000 |
---|---|---|
committer | Ken Werner <ken.werner@de.ibm.com> | 2010-11-03 14:21:58 +0000 |
commit | dbc98a8b6eb97ea7315e04103cdfec5add47f3c4 (patch) | |
tree | 767338cf124ded0f5c63ea6521f6a72b84095488 /gdb/valops.c | |
parent | 27dee630aae66dd61eb20135e7b8384088b1a496 (diff) | |
download | gdb-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/valops.c')
-rw-r--r-- | gdb/valops.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 22ba54a..e98f7c1 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -544,14 +544,17 @@ value_cast (struct type *type, struct value *arg2) /* Widen the scalar to a vector. */ struct type *eltype; struct value *val; - int i, n; + LONGEST low_bound, high_bound; + int i; + + if (!get_array_bounds (type, &low_bound, &high_bound)) + error (_("Could not determine the vector bounds")); eltype = check_typedef (TYPE_TARGET_TYPE (type)); arg2 = value_cast (eltype, arg2); val = allocate_value (type); - n = TYPE_LENGTH (type) / TYPE_LENGTH (eltype); - for (i = 0; i < n; i++) + for (i = 0; i < high_bound - low_bound + 1; i++) { /* Duplicate the contents of arg2 into the destination vector. */ memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)), |