Convert some frame functions to use gdb::array_view.
[deliverable/binutils-gdb.git] / gdb / trad-frame.c
index 17375e83482c3286b294489d4daafb71291ed36d..53bd097a2b34b2abceec1f972cebf8f3721dceef 100644 (file)
@@ -25,6 +25,7 @@
 #include "target.h"
 #include "value.h"
 #include "gdbarch.h"
+#include "gdbsupport/traits.h"
 
 struct trad_frame_cache
 {
@@ -60,7 +61,9 @@ trad_frame_reset_saved_regs (struct gdbarch *gdbarch,
 trad_frame_saved_reg *
 trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
 {
-  gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
+#ifdef HAVE_IS_TRIVIALLY_CONSTRUCTIBLE
+  gdb_static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
+#endif
 
   int numregs = gdbarch_num_cooked_regs (gdbarch);
   trad_frame_saved_reg *this_saved_regs
@@ -226,12 +229,12 @@ trad_frame_set_unknown (trad_frame_saved_reg this_saved_regs[],
 
 void
 trad_frame_set_value_bytes (trad_frame_saved_reg this_saved_regs[],
-                           int regnum, const gdb_byte *bytes,
-                           size_t size)
+                           int regnum,
+                           gdb::array_view<const gdb_byte> bytes)
 {
   /* Allocate the space and copy the data bytes.  */
-  gdb_byte *data = FRAME_OBSTACK_CALLOC (size, gdb_byte);
-  memcpy (data, bytes, size);
+  gdb_byte *data = FRAME_OBSTACK_CALLOC (bytes.size (), gdb_byte);
+  memcpy (data, bytes.data (), bytes.size ());
   this_saved_regs[regnum].set_value_bytes (data);
 }
 
@@ -239,13 +242,12 @@ trad_frame_set_value_bytes (trad_frame_saved_reg this_saved_regs[],
 
 void
 trad_frame_set_reg_value_bytes (struct trad_frame_cache *this_trad_cache,
-                               int regnum, const gdb_byte *bytes,
-                               size_t size)
+                               int regnum,
+                               gdb::array_view<const gdb_byte> bytes)
 {
   /* External interface for users of trad_frame_cache
      (who cannot access the prev_regs object directly).  */
-  trad_frame_set_value_bytes (this_trad_cache->prev_regs, regnum, bytes,
-                             size);
+  trad_frame_set_value_bytes (this_trad_cache->prev_regs, regnum, bytes);
 }
 
 
This page took 0.02559 seconds and 4 git commands to generate.