summaryrefslogtreecommitdiff
path: root/gdb/trad-frame.c
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2020-12-23 16:06:11 -0300
committerLuis Machado <luis.machado@linaro.org>2021-01-19 10:26:52 -0300
commitccbe4c82d5219502806dc62aa1cf51e5b1a4b479 (patch)
tree5e3b6973a19cee71128da07880c85464b702d5ef /gdb/trad-frame.c
parent26503e2f5eae6019c8649a3dd204a82705efc740 (diff)
downloadbinutils-gdb-ccbe4c82d5219502806dc62aa1cf51e5b1a4b479.tar.gz
Use gdb::array_view for setting value bytes in trad-frame
This patch updates the functions setting value bytes in trad-frame to use a gdb::array_view instead of passing a buffer and a size. gdb/ChangeLog: 2021-01-19 Luis Machado <luis.machado@linaro.org> * aarch64-linux-tdep.c (aarch64_linux_restore_vreg): Pass in an array_view. * trad-frame.c (trad_frame_set_value_bytes): Use gdb::array_view instead of buffer and size. (trad_frame_set_reg_value_bytes): Likewise. * trad-frame.h (trad_frame_set_reg_value_bytes): Likewise. (trad_frame_set_value_bytes): Likewise.
Diffstat (limited to 'gdb/trad-frame.c')
-rw-r--r--gdb/trad-frame.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 3284c452317..53bd097a2b3 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -229,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);
}
@@ -242,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);
}