diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-07-31 14:06:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-08-02 16:54:25 -0400 |
commit | d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5 (patch) | |
tree | 0f976ca65d4bb650f182b3c3e24aa0876b06a1c6 /gdb/i386-linux-nat.c | |
parent | 6ce1ea97af20b9e618c524aa719e70c17dacda74 (diff) | |
download | gdb-d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5.zip gdb-d724d71ad22b9d4b8e659d9c44cce8b724f4f7f5.tar.gz gdb-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/i386-linux-nat.c')
-rw-r--r-- | gdb/i386-linux-nat.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index bfe3fb8..0e360b1 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -315,19 +315,19 @@ fetch_xstateregs (struct regcache *regcache, int tid) { struct gdbarch *gdbarch = regcache->arch (); const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); - char xstateregs[tdep->xsave_layout.sizeof_xsave]; + gdb::byte_vector xstateregs (tdep->xsave_layout.sizeof_xsave); struct iovec iov; if (have_ptrace_getregset != TRIBOOL_TRUE) return 0; - iov.iov_base = xstateregs; - iov.iov_len = sizeof(xstateregs); + iov.iov_base = xstateregs.data (); + iov.iov_len = xstateregs.size (); if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0) perror_with_name (_("Couldn't read extended state status")); - i387_supply_xsave (regcache, -1, xstateregs); + i387_supply_xsave (regcache, -1, xstateregs.data ()); return 1; } @@ -340,19 +340,19 @@ store_xstateregs (const struct regcache *regcache, int tid, int regno) { struct gdbarch *gdbarch = regcache->arch (); const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch); - char xstateregs[tdep->xsave_layout.sizeof_xsave]; + gdb::byte_vector xstateregs (tdep->xsave_layout.sizeof_xsave); struct iovec iov; if (have_ptrace_getregset != TRIBOOL_TRUE) return 0; - - iov.iov_base = xstateregs; - iov.iov_len = sizeof(xstateregs); + + iov.iov_base = xstateregs.data (); + iov.iov_len = xstateregs.size (); if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0) perror_with_name (_("Couldn't read extended state status")); - i387_collect_xsave (regcache, regno, xstateregs, 0); + i387_collect_xsave (regcache, regno, xstateregs.data (), 0); if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE, (int) &iov) < 0) |