diff options
author | Ken Werner <ken.werner@de.ibm.com> | 2010-12-14 10:23:41 +0000 |
---|---|---|
committer | Ken Werner <ken.werner@de.ibm.com> | 2010-12-14 10:23:41 +0000 |
commit | cfa6f0541f6a343e4ae51c1b66ab0e3f566cf3ea (patch) | |
tree | 2ed804d745f0775a35c60b505087e797b032e679 /gdb/valops.c | |
parent | 043b6510015086daf0b084955c4b1da2ee1f0e24 (diff) | |
download | gdb-cfa6f0541f6a343e4ae51c1b66ab0e3f566cf3ea.zip gdb-cfa6f0541f6a343e4ae51c1b66ab0e3f566cf3ea.tar.gz gdb-cfa6f0541f6a343e4ae51c1b66ab0e3f566cf3ea.tar.bz2 |
gdb:
* valops.c (value_one): 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 (value_complement, value_neg): Likewise.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index dfadad8..7ea6315 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -877,11 +877,15 @@ value_one (struct type *type, enum lval_type lv) else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) { struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1)); - int i, n = TYPE_LENGTH (type1) / TYPE_LENGTH (eltype); + int i; + LONGEST low_bound, high_bound; struct value *tmp; + if (!get_array_bounds (type1, &low_bound, &high_bound)) + error (_("Could not determine the vector bounds")); + val = allocate_value (type); - for (i = 0; i < n; i++) + for (i = 0; i < high_bound - low_bound + 1; i++) { tmp = value_one (eltype, lv); memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype), |