]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/hurd: remove VLA usage
authorFlavio Cruz <flaviocruz@gmail.com>
Sun, 22 Dec 2024 05:34:35 +0000 (00:34 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 22 Dec 2024 14:25:04 +0000 (09:25 -0500)
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

gdb/gnu-nat.c

index a8a4da1c8732b40cb811315768ce0a2d5a0b4c16..c6fe7a9ab5c75e857a4b3c860d895db53e38ff7a 100644 (file)
@@ -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;