diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7c61032..990bad7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-05-05 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (ada_value_primitive_packed_val): Recompute + BIT_SIZE and LEN if the size of the resolved type is smaller + than BIT_SIZE * HOST_CHAR_BIT. + +2015-05-05 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (ada_value_primitive_packed_val): Use a more correct address in call to value_at. Adjust call to value_address accordingly. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 42f84e4..d0aea26 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2419,6 +2419,17 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, { v = value_at (type, value_address (obj) + offset); type = value_type (v); + if (TYPE_LENGTH (type) * HOST_CHAR_BIT < bit_size) + { + /* This can happen in the case of an array of dynamic objects, + where the size of each element changes from element to element. + In that case, we're initially given the array stride, but + after resolving the element type, we find that its size is + less than this stride. In that case, adjust bit_size to + match TYPE's length, and recompute LEN accordingly. */ + bit_size = TYPE_LENGTH (type) * HOST_CHAR_BIT; + len = TYPE_LENGTH (type) + (bit_offset + HOST_CHAR_BIT - 1) / 8; + } bytes = (unsigned char *) alloca (len); read_memory (value_address (v), bytes, len); } |