diff --git a/gdb/frame.c b/gdb/frame.c
index a6900b280724..2c1ea012191b 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1112,7 +1112,7 @@ frame_save_as_regcache (const frame_info_ptr &this_frame)
 {
   auto cooked_read = [this_frame] (int regnum, gdb::array_view<gdb_byte> buf)
     {
-      if (!deprecated_frame_register_read (this_frame, regnum, buf.data ()))
+      if (!deprecated_frame_register_read (this_frame, regnum, buf))
 	return REG_UNAVAILABLE;
       else
 	return REG_VALID;
@@ -1177,7 +1177,8 @@ void
 frame_register_unwind (const frame_info_ptr &next_frame, int regnum,
 		       int *optimizedp, int *unavailablep,
 		       enum lval_type *lvalp, CORE_ADDR *addrp,
-		       int *realnump, gdb_byte *bufferp)
+		       int *realnump,
+		       std::optional<gdb::array_view<gdb_byte>> bufferp)
 {
   struct value *value;
 
@@ -1204,11 +1205,13 @@ frame_register_unwind (const frame_info_ptr &next_frame, int regnum,
 
   if (bufferp)
     {
+      gdb_assert (bufferp->size () >= value->type ()->length ());
+
       if (!*optimizedp && !*unavailablep)
-	memcpy (bufferp, value->contents_all ().data (),
+	memcpy (bufferp->data (), value->contents_all ().data (),
 		value->type ()->length ());
       else
-	memset (bufferp, 0, value->type ()->length ());
+	memset (bufferp->data (), 0, value->type ()->length ());
     }
 
   /* Dispose of the new value.  This prevents watchpoints from
@@ -1217,7 +1220,8 @@ frame_register_unwind (const frame_info_ptr &next_frame, int regnum,
 }
 
 void
-frame_unwind_register (const frame_info_ptr &next_frame, int regnum, gdb_byte *buf)
+frame_unwind_register (const frame_info_ptr &next_frame, int regnum,
+		       gdb::array_view<gdb_byte> buf)
 {
   int optimized;
   int unavailable;
@@ -1238,7 +1242,7 @@ frame_unwind_register (const frame_info_ptr &next_frame, int regnum, gdb_byte *b
 
 void
 get_frame_register (const frame_info_ptr &frame,
-		    int regnum, gdb_byte *buf)
+		    int regnum, gdb::array_view<gdb_byte> buf)
 {
   frame_unwind_register (frame_info_ptr (frame->next), regnum, buf);
 }
@@ -1447,7 +1451,7 @@ put_frame_register (const frame_info_ptr &next_frame, int regnum,
   gdb_assert (buf.size () == size);
 
   frame_register_unwind (next_frame, regnum, &optim, &unavail, &lval, &addr,
-			 &realnum, nullptr);
+			 &realnum);
   if (optim)
     error (_("Attempt to assign to a register that was not saved."));
   switch (lval)
@@ -1482,7 +1486,7 @@ put_frame_register (const frame_info_ptr &next_frame, int regnum,
 
 bool
 deprecated_frame_register_read (const frame_info_ptr &frame, int regnum,
-				gdb_byte *myaddr)
+				gdb::array_view<gdb_byte> myaddr)
 {
   int optimized;
   int unavailable;
@@ -1541,7 +1545,7 @@ get_frame_register_bytes (const frame_info_ptr &next_frame, int regnum,
 	  int realnum;
 
 	  frame_register_unwind (next_frame, regnum, optimizedp, unavailablep,
-				 &lval, &addr, &realnum, buffer.data ());
+				 &lval, &addr, &realnum, buffer);
 	  if (*optimizedp || *unavailablep)
 	    return false;
 	}
@@ -2159,7 +2163,7 @@ frame_register_unwind_location (const frame_info_ptr &initial_this_frame,
       int unavailable;
 
       frame_register_unwind (this_frame, regnum, optimizedp, &unavailable,
-			     lvalp, addrp, realnump, NULL);
+			     lvalp, addrp, realnump);
 
       if (*optimizedp)
 	break;
diff --git a/gdb/frame.h b/gdb/frame.h
index e784c17b4807..23a3ade69c92 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -692,7 +692,7 @@ extern void frame_register_unwind (const frame_info_ptr &frame, int regnum,
 				   int *optimizedp, int *unavailablep,
 				   enum lval_type *lvalp,
 				   CORE_ADDR *addrp, int *realnump,
-				   gdb_byte *valuep);
+				   std::optional<gdb::array_view<gdb_byte>> valuep = {});
 
 /* Fetch a register from this, or unwind a register from the next
    frame.  Note that the get_frame methods are wrappers to
@@ -701,9 +701,9 @@ extern void frame_register_unwind (const frame_info_ptr &frame, int regnum,
    do return a lazy value.  */
 
 extern void frame_unwind_register (const frame_info_ptr &next_frame,
-				   int regnum, gdb_byte *buf);
+				   int regnum, gdb::array_view<gdb_byte> buf);
 extern void get_frame_register (const frame_info_ptr &frame,
-				int regnum, gdb_byte *buf);
+				int regnum, gdb::array_view<gdb_byte> buf);
 
 struct value *frame_unwind_register_value (const frame_info_ptr &next_frame,
 					   int regnum);
@@ -889,7 +889,7 @@ extern void print_frame_info (const frame_print_options &fp_opts,
 extern frame_info_ptr block_innermost_frame (const struct block *);
 
 extern bool deprecated_frame_register_read (const frame_info_ptr &frame, int regnum,
-					    gdb_byte *buf);
+					    gdb::array_view<gdb_byte> buf);
 
 /* From stack.c.  */
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c00efbd02ad0..24970c7637ad 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -951,14 +951,17 @@ mips_register_to_value (const frame_info_ptr &frame, int regnum,
 
   if (mips_convert_register_float_case_p (gdbarch, regnum, type))
     {
-      get_frame_register (frame, regnum + 0, to + 4);
-      get_frame_register (frame, regnum + 1, to + 0);
+      gdb::array_view<gdb_byte> first_half = gdb::make_array_view (to, 4);
+      gdb::array_view<gdb_byte> second_half = gdb::make_array_view (to + 4, 4);
 
-      if (!get_frame_register_bytes (next_frame, regnum + 0, 0, { to + 4, 4 },
+      get_frame_register (frame, regnum + 0, second_half);
+      get_frame_register (frame, regnum + 1, first_half);
+
+      if (!get_frame_register_bytes (next_frame, regnum + 0, 0, second_half,
 				     optimizedp, unavailablep))
 	return 0;
 
-      if (!get_frame_register_bytes (next_frame, regnum + 1, 0, { to + 0, 4 },
+      if (!get_frame_register_bytes (next_frame, regnum + 1, 0, first_half,
 				     optimizedp, unavailablep))
 	return 0;
       *optimizedp = *unavailablep = 0;
@@ -6257,8 +6260,10 @@ mips_read_fp_register_single (const frame_info_ptr &frame, int regno,
   struct gdbarch *gdbarch = get_frame_arch (frame);
   int raw_size = register_size (gdbarch, regno);
   gdb_byte *raw_buffer = (gdb_byte *) alloca (raw_size);
+  gdb::array_view<gdb_byte> raw_view = gdb::make_array_view (raw_buffer,
+							     raw_size);
 
-  if (!deprecated_frame_register_read (frame, regno, raw_buffer))
+  if (!deprecated_frame_register_read (frame, regno, raw_view))
     error (_("can't read register %d (%s)"),
 	   regno, gdbarch_register_name (gdbarch, regno));
   if (raw_size == 8)
@@ -6295,7 +6300,9 @@ mips_read_fp_register_double (const frame_info_ptr &frame, int regno,
     {
       /* We have a 64-bit value for this register, and we should use
 	 all 64 bits.  */
-      if (!deprecated_frame_register_read (frame, regno, rare_buffer))
+      gdb::array_view<gdb_byte> rare_view = gdb::make_array_view (rare_buffer,
+								  raw_size);
+      if (!deprecated_frame_register_read (frame, regno, rare_view))
 	error (_("can't read register %d (%s)"),
 	       regno, gdbarch_register_name (gdbarch, regno));
     }
diff --git a/gdb/stack.c b/gdb/stack.c
index 4a3e7e4ff006..b585e6e636d5 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1750,7 +1750,7 @@ info_frame_command_core (const frame_info_ptr &fi, bool selected_frame_p)
 	  /* Find out the location of the saved register without
 	     fetching the corresponding value.  */
 	  frame_register_unwind (fi, i, &optimized, &unavailable,
-				 &lval, &addr, &realnum, NULL);
+				 &lval, &addr, &realnum);
 	  /* For moment, only display registers that were saved on the
 	     stack.  */
 	  if (!optimized && !unavailable && lval == lval_memory)
