diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-04-23 16:46:06 +0000 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2024-04-23 20:52:54 +0000 |
commit | 22813df1897ce505665b2fb19f07c6d44b9019b0 (patch) | |
tree | 9fc2de094fd199f8876c2f2086e4686ad929f7ec /gdb/fbsd-tdep.c | |
parent | c527001f381536f565291c29663e3ee310b9aedb (diff) | |
download | binutils-22813df1897ce505665b2fb19f07c6d44b9019b0.zip binutils-22813df1897ce505665b2fb19f07c6d44b9019b0.tar.gz binutils-22813df1897ce505665b2fb19f07c6d44b9019b0.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.
Change-Id: I3e5e34fcac51f3e6b732bb801c77944e010b162e
Diffstat (limited to 'gdb/fbsd-tdep.c')
-rw-r--r-- | gdb/fbsd-tdep.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index a80f604..cdc1631 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -2033,21 +2033,23 @@ fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr, { LONGEST tls_index = fbsd_get_tls_index (gdbarch, lm_addr); - gdb_byte buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT]; - if (target_read_memory (dtv_addr, buf, sizeof buf) != 0) + gdb::byte_vector buf (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT); + if (target_read_memory (dtv_addr, buf.data (), buf.size ()) != 0) throw_error (TLS_GENERIC_ERROR, _("Cannot find thread-local variables on this target")); const struct builtin_type *builtin = builtin_type (gdbarch); - CORE_ADDR addr = gdbarch_pointer_to_address (gdbarch, - builtin->builtin_data_ptr, buf); + CORE_ADDR addr + = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, + buf.data ()); addr += (tls_index + 1) * builtin->builtin_data_ptr->length (); - if (target_read_memory (addr, buf, sizeof buf) != 0) + if (target_read_memory (addr, buf.data (), buf.size ()) != 0) throw_error (TLS_GENERIC_ERROR, _("Cannot find thread-local variables on this target")); - addr = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, buf); + addr = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, + buf.data ()); return addr + offset; } |