From db3a1dc7c9404e203c54576db3335e69d995e83e Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Tue, 4 Apr 2017 08:42:30 +0100 Subject: [PATCH] Remove MAX_REGISTER_SIZE from frame.c gdb/ * frame.c (get_frame_register_bytes): Unwind using value. (put_frame_register_bytes): Likewise. --- gdb/ChangeLog | 5 +++++ gdb/frame.c | 35 ++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bfa535851d8..0fa4770ee40 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-05-04 Alan Hayward + + * frame.c (get_frame_register_bytes): Unwind using value. + (put_frame_register_bytes): Likewise. + 2017-03-29 Jan Kratochvil * auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS. diff --git a/gdb/frame.c b/gdb/frame.c index d98003dee7c..05a3be400c3 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1410,16 +1410,21 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, } else { - gdb_byte buf[MAX_REGISTER_SIZE]; - enum lval_type lval; - CORE_ADDR addr; - int realnum; + struct value *value = frame_unwind_register_value (frame->next, + regnum); + gdb_assert (value != NULL); + *optimizedp = value_optimized_out (value); + *unavailablep = !value_entirely_available (value); - frame_register (frame, regnum, optimizedp, unavailablep, - &lval, &addr, &realnum, buf); if (*optimizedp || *unavailablep) - return 0; - memcpy (myaddr, buf + offset, curr_len); + { + release_value (value); + value_free (value); + return 0; + } + memcpy (myaddr, value_contents_all (value) + offset, curr_len); + release_value (value); + value_free (value); } myaddr += curr_len; @@ -1460,11 +1465,15 @@ put_frame_register_bytes (struct frame_info *frame, int regnum, } else { - gdb_byte buf[MAX_REGISTER_SIZE]; - - deprecated_frame_register_read (frame, regnum, buf); - memcpy (buf + offset, myaddr, curr_len); - put_frame_register (frame, regnum, buf); + struct value *value = frame_unwind_register_value (frame->next, + regnum); + gdb_assert (value != NULL); + + memcpy ((char *) value_contents_writeable (value) + offset, myaddr, + curr_len); + put_frame_register (frame, regnum, value_contents_raw (value)); + release_value (value); + value_free (value); } myaddr += curr_len; -- 2.30.2