diff options
author | Tom Tromey <tom@tromey.com> | 2024-04-16 13:12:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-04-21 12:33:56 -0600 |
commit | 6e4be957f79b67c117220b39a663c0319dec6b2d (patch) | |
tree | 13b60fe4be599e69f1dc2320fe3217af9d66a139 /gdb/arc-linux-tdep.c | |
parent | e6375bc8ebbbc177c79f08e9616eb0b131229f65 (diff) | |
download | gdb-6e4be957f79b67c117220b39a663c0319dec6b2d.zip gdb-6e4be957f79b67c117220b39a663c0319dec6b2d.tar.gz gdb-6e4be957f79b67c117220b39a663c0319dec6b2d.tar.bz2 |
Remove a couple of VLAs
I found a couple of spots where VLAs are in use but where they can
easily be removed.
In one spot, adding 'const' is enough -- and is already done in
similar code elsewhere in the file.
In another spot, one of two arrays will be used, so making the buffer
large enough for both works.
Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/arc-linux-tdep.c')
-rw-r--r-- | gdb/arc-linux-tdep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c index 54406ac..30bd40c 100644 --- a/gdb/arc-linux-tdep.c +++ b/gdb/arc-linux-tdep.c @@ -174,6 +174,9 @@ arc_linux_is_sigtramp (const frame_info_ptr &this_frame) 0x22, 0x6f, 0x00, 0x3f /* swi */ }; + constexpr size_t max_insn_sz = std::max (sizeof (insns_be_hs), + sizeof (insns_be_700)); + gdb_byte arc_sigtramp_insns[sizeof (insns_be_700)]; size_t insns_sz; if (arc_mach_is_arcv2 (gdbarch)) @@ -200,7 +203,8 @@ arc_linux_is_sigtramp (const frame_info_ptr &this_frame) std::swap (arc_sigtramp_insns[i], arc_sigtramp_insns[i+1]); } - gdb_byte buf[insns_sz]; + gdb_assert (insns_sz <= max_insn_sz); + gdb_byte buf[max_insn_sz]; /* Read the memory at the PC. Since we are stopped, any breakpoint must have been removed. */ |