From d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 31 Jul 2024 14:06:12 -0400 Subject: 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 --- gdb/trad-frame.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gdb/trad-frame.c') 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); } } -- cgit v1.1