diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2008-06-06 06:48:36 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2008-06-06 06:48:36 +0000 |
commit | aced2898db4da63573b0d9af3da8d58fac23c434 (patch) | |
tree | 38e27048a8cdc1d45bfab153d4cd5531fc1543d5 /gdb | |
parent | 97407faf3da58e5e3bd1d042e746d8e328b00ce3 (diff) | |
download | ppe42-binutils-aced2898db4da63573b0d9af3da8d58fac23c434.tar.gz ppe42-binutils-aced2898db4da63573b0d9af3da8d58fac23c434.zip |
ada_value_assign: Correct big-endian case to take into account the bitsize
of the 'from' operand.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d8994756c1..f17ed4007b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-06-06 Paul N. Hilfinger <hilfinger@adacore.com> + + * ada-lang.c (ada_value_assign): Correct big-endian case to take into + account the bitsize of the 'from' operand. + 2008-06-06 Pedro Alves <pedro@codesourcery.com> * annotate.h (annotate_thread_changed): Declare. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ea55bbce9a..cb85617fac 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2252,6 +2252,7 @@ ada_value_assign (struct value *toval, struct value *fromval) { int len = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; + int from_size; char *buffer = (char *) alloca (len); struct value *val; CORE_ADDR to_addr = VALUE_ADDRESS (toval) + value_offset (toval); @@ -2260,11 +2261,12 @@ ada_value_assign (struct value *toval, struct value *fromval) fromval = value_cast (type, fromval); read_memory (to_addr, buffer, len); + from_size = value_bitsize (fromval); + if (from_size == 0) + from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT; if (gdbarch_bits_big_endian (current_gdbarch)) move_bits (buffer, value_bitpos (toval), - value_contents (fromval), - TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT - - bits, bits); + value_contents (fromval), from_size - bits, bits); else move_bits (buffer, value_bitpos (toval), value_contents (fromval), 0, bits); |