diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00731226ac..27e56c368d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-06-06 Alan Hayward + + * frame.c (frame_unwind_register_signed): Use + frame_unwind_register_value. + 2017-06-06 Pedro Alves PR breakpoints/21553 diff --git a/gdb/frame.c b/gdb/frame.c index efe5a20591..30e4aeab7e 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1252,10 +1252,27 @@ frame_unwind_register_signed (struct frame_info *frame, int regnum) struct gdbarch *gdbarch = frame_unwind_arch (frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int size = register_size (gdbarch, regnum); - gdb_byte buf[MAX_REGISTER_SIZE]; + struct value *value = frame_unwind_register_value (frame, regnum); - frame_unwind_register (frame, regnum, buf); - return extract_signed_integer (buf, size, byte_order); + gdb_assert (value != NULL); + + if (value_optimized_out (value)) + { + throw_error (OPTIMIZED_OUT_ERROR, + _("Register %d was not saved"), regnum); + } + if (!value_entirely_available (value)) + { + throw_error (NOT_AVAILABLE_ERROR, + _("Register %d is not available"), regnum); + } + + LONGEST r = extract_signed_integer (value_contents_all (value), size, + byte_order); + + release_value (value); + value_free (value); + return r; } LONGEST