diff mbox

Remove a MAX_REGISTER_SIZE from frame.c

Message ID C90EE1CC-BEA0-4A0D-94C1-D3210F389747@arm.com
State New
Headers show

Commit Message

Alan Hayward June 5, 2017, 4:33 p.m. UTC
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.

Comments

Yao Qi June 6, 2017, 3:30 p.m. UTC | #1
Alan Hayward <Alan.Hayward@arm.com> writes:

> Ok to commit?
>
> Alan.
>
>
> 2017-06-05 Alan Hayward  <alan.hayward@arm.com>
>
> 	* frame.c (frame_unwind_register_signed): Use
> 	frame_unwind_register_value.

Looks good to me.
diff mbox

Patch

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