This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Remove a MAX_REGISTER_SIZE from frame.c
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Mon, 5 Jun 2017 16:33:45 +0000
- Subject: [PATCH] Remove a MAX_REGISTER_SIZE from frame.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Make frame_unwind_register_signed look the same as
frame_unwind_register_unsigned.
This change got missed in a previous patch.
Tested on a --enable-targets=all build using make check with board files
unix and native-gdbserver.
Ok to commit?
Alan.
2017-06-05 Alan Hayward <alan.hayward@arm.com>
* frame.c (frame_unwind_register_signed): Use
frame_unwind_register_value.
diff --git a/gdb/frame.c b/gdb/frame.c
index efe5a20591dd2667200f85e0cff07dbe79ee3e87..30e4aeab7e2901074c289ac4d96ebda885805a29 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);
+
+ 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);
+ }
- frame_unwind_register (frame, regnum, buf);
- return extract_signed_integer (buf, size, byte_order);
+ LONGEST r = extract_signed_integer (value_contents_all (value), size,
+ byte_order);
+
+ release_value (value);
+ value_free (value);
+ return r;
}
LONGEST