diff options
author | Alan Hayward <alan.hayward@arm.com> | 2017-06-06 15:45:08 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2017-06-06 15:45:08 +0100 |
commit | fbe654c8bc78eb06b6d7ee4fcec64e9e34e7a9ac (patch) | |
tree | 4a07f2353d4b36df08c7e485797b92ccba467483 | |
parent | 9949827bea788753c29b7bb503d6d5dda6ea21ff (diff) | |
download | gdb-fbe654c8bc78eb06b6d7ee4fcec64e9e34e7a9ac.zip gdb-fbe654c8bc78eb06b6d7ee4fcec64e9e34e7a9ac.tar.gz gdb-fbe654c8bc78eb06b6d7ee4fcec64e9e34e7a9ac.tar.bz2 |
Remove uses of MAX_REGISTER_SIZE from alpha-tdep.c
gdb/
* alpha-tdep.c (alpha_register_to_value): Use
get_frame_register_value.
(alpha_value_to_register): Use ALPHA_REGISTER_SIZE.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/alpha-tdep.c | 29 |
2 files changed, 26 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5452285..319e9c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-06-06 Alan Hayward <alan.hayward@arm.com> + * alpha-tdep.c (alpha_register_to_value): Use + get_frame_register_value. + (alpha_value_to_register): Use ALPHA_REGISTER_SIZE. + +2017-06-06 Alan Hayward <alan.hayward@arm.com> + * ia64-tdep.c (IA64_MAX_FP_REGISTER_SIZE) Add. (ia64_register_to_value): Use IA64_MAX_FP_REGISTER_SIZE. (ia64_value_to_register): Likewise. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index d7cc0f4..06ee90c 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -244,17 +244,26 @@ alpha_register_to_value (struct frame_info *frame, int regnum, int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); - gdb_byte in[MAX_REGISTER_SIZE]; + struct value *value = get_frame_register_value (frame, regnum); - /* Convert to TYPE. */ - if (!get_frame_register_bytes (frame, regnum, 0, - register_size (gdbarch, regnum), - in, optimizedp, unavailablep)) - return 0; + gdb_assert (value != NULL); + *optimizedp = value_optimized_out (value); + *unavailablep = !value_entirely_available (value); + + if (*optimizedp || *unavailablep) + { + release_value (value); + value_free (value); + return 0; + } + + /* Convert to VALTYPE. */ gdb_assert (TYPE_LENGTH (valtype) == 4); - alpha_sts (gdbarch, out, in); - *optimizedp = *unavailablep = 0; + alpha_sts (gdbarch, out, value_contents_all (value)); + + release_value (value); + value_free (value); return 1; } @@ -262,9 +271,11 @@ static void alpha_value_to_register (struct frame_info *frame, int regnum, struct type *valtype, const gdb_byte *in) { - gdb_byte out[MAX_REGISTER_SIZE]; + gdb_byte out[ALPHA_REGISTER_SIZE]; gdb_assert (TYPE_LENGTH (valtype) == 4); + gdb_assert (register_size (get_frame_arch (frame), regnum) + <= ALPHA_REGISTER_SIZE); alpha_lds (get_frame_arch (frame), out, in); put_frame_register (frame, regnum, out); |