diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2024-12-22 00:34:35 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-12-22 09:25:04 -0500 |
commit | 1898ec362a5930c6925d84785b681576acdbcb99 (patch) | |
tree | 8b77feef2c088baed16e50a1f0681a3c8a56f1c6 | |
parent | 3dc8bef12e08ba80f7c256d4de87704fd6591d67 (diff) | |
download | gdb-1898ec362a5930c6925d84785b681576acdbcb99.zip gdb-1898ec362a5930c6925d84785b681576acdbcb99.tar.gz gdb-1898ec362a5930c6925d84785b681576acdbcb99.tar.bz2 |
gdb/hurd: remove VLA usage
Compilation will fail with -Werror=vla, which seems to be the default.
Note that we don't need to allocate num_threads + 1 since the matching
algorithm works only on the num_threads as returned by task_threads.
Change-Id: I276928d0ff3c52c7c7fe4edb857e5789cdabfcf7
-rw-r--r-- | gdb/gnu-nat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index a8a4da1..c6fe7a9 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1016,15 +1016,16 @@ gnu_nat_target::inf_validate_procs (struct inf *inf) { /* Make things normally linear. */ mach_msg_type_number_t search_start = 0; - /* Which thread in PROCS corresponds to each task thread, & the task. */ - struct proc *matched[num_threads + 1]; + + /* Which thread in PROCS corresponds to each task thread. */ + std::vector<struct proc *> matched (num_threads); + /* The last thread in INF->threads, so we can add to the end. */ struct proc *last = 0; + /* The current thread we're considering. */ struct proc *thread = inf->threads; - memset (matched, 0, sizeof (matched)); - while (thread) { mach_msg_type_number_t left; |