summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-04-05 14:55:43 +0100
committerYao Qi <yao.qi@linaro.org>2017-04-05 14:55:43 +0100
commit2cad08ea7dbc96103da9957da6973f9d0dbc33a8 (patch)
tree719a3ac3de641de3475a0b7e090cdce1172407d0
parent55a98976756cb2df83ac8f8e9799331fbcc4f669 (diff)
downloadbinutils-gdb-2cad08ea7dbc96103da9957da6973f9d0dbc33a8.tar.gz
Use frame_unwind_register_value in frame_unwind_register_unsigned
gdb: 2017-04-05 Yao Qi <yao.qi@linaro.org> * frame.c (frame_unwind_register_unsigned): Call frame_unwind_register_value.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/frame.c23
2 files changed, 25 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92f5b2294d9..c3999b67c44 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-04-05 Yao Qi <yao.qi@linaro.org>
+ * frame.c (frame_unwind_register_unsigned): Call
+ frame_unwind_register_value.
+
+2017-04-05 Yao Qi <yao.qi@linaro.org>
+
* gdb.threads/thread-specific-bp.exp (check_thread_specific_breakpoint):
Use gdb_test_multiple, and don't match anchor.
diff --git a/gdb/frame.c b/gdb/frame.c
index 05a3be400c3..d4fc456e2a8 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1270,10 +1270,27 @@ frame_unwind_register_unsigned (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_unsigned_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);
+ }
+
+ ULONGEST r = extract_unsigned_integer (value_contents_all (value), size,
+ byte_order);
+
+ release_value (value);
+ value_free (value);
+ return r;
}
ULONGEST