Remove a MAX_REGISTER_SIZE from frame.c
authorAlan Hayward <alan.hayward@arm.com>
Tue, 6 Jun 2017 15:34:20 +0000 (16:34 +0100)
committerAlan Hayward <alan.hayward@arm.com>
Tue, 6 Jun 2017 15:34:20 +0000 (16:34 +0100)
gdb/
* frame.c (frame_unwind_register_signed): Use
frame_unwind_register_value.

gdb/ChangeLog
gdb/frame.c

index 00731226acd0e4a7483009481d7df66d2f5c1ed1..27e56c368d7b9b93e2216a46d73331c912c47355 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-06 Alan Hayward  <alan.hayward@arm.com>
+
+       * frame.c (frame_unwind_register_signed): Use
+       frame_unwind_register_value.
+
 2017-06-06  Pedro Alves  <palves@redhat.com>
 
        PR breakpoints/21553
index efe5a20591dd2667200f85e0cff07dbe79ee3e87..30e4aeab7e2901074c289ac4d96ebda885805a29 100644 (file)
@@ -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