aboutsummaryrefslogtreecommitdiff
path: root/gdb/trad-frame.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-07-31 14:06:12 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2024-08-02 16:54:25 -0400
commitd724d71ad22b9d4b8e659d9c44cce8b724f4f7f5 (patch)
tree0f976ca65d4bb650f182b3c3e24aa0876b06a1c6 /gdb/trad-frame.c
parent6ce1ea97af20b9e618c524aa719e70c17dacda74 (diff)
downloadbinutils-d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5.zip
binutils-d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5.tar.gz
binutils-d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5.tar.bz2
gdb: remove uses of VLA
Remove uses of VLAs, replace with gdb::byte_vector. There might be more in files that I can't compile, but it's difficult to tell without actually compiling on all platforms. Many thanks to the Linaro pre-commit CI for helping find some problems with an earlier iteration of this patch. Change-Id: I3e5e34fcac51f3e6b732bb801c77944e010b162e Reviewed-by: Keith Seitz <keiths@redhat.com>
Diffstat (limited to 'gdb/trad-frame.c')
-rw-r--r--gdb/trad-frame.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index e64374a..35bf02e 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -154,12 +154,14 @@ trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache,
else
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- gdb_byte buf[slot_size];
+ gdb::byte_vector buf (slot_size);
- if (target_read_memory (addr + offs, buf, sizeof buf) == 0)
+ if (target_read_memory (addr + offs, buf.data (), buf.size ())
+ == 0)
{
LONGEST val
- = extract_unsigned_integer (buf, sizeof buf, byte_order);
+ = extract_unsigned_integer (buf.data (), buf.size (),
+ byte_order);
trad_frame_set_reg_value (this_trad_cache, regno, val);
}
}