[Ada] Add ada-tasks.c:iterate_over_live_ada_tasks
[deliverable/binutils-gdb.git] / gdb / ada-tasks.c
index 8e42252d42e3fe62e27ff794305d284bd25150c0..3cbcc4fe4df35c86ffbe8879ebedc4277b1e705b 100644 (file)
@@ -212,6 +212,27 @@ ada_task_is_alive (struct ada_task_info *task_info)
   return (task_info->state != Terminated);
 }
 
+/* Call the ITERATOR function once for each Ada task that hasn't been
+   terminated yet.  */
+
+void
+iterate_over_live_ada_tasks (ada_task_list_iterator_ftype *iterator)
+{
+  int i, nb_tasks;
+  struct ada_task_info *task;
+
+  ada_build_task_list (0);
+  nb_tasks = VEC_length (ada_task_info_s, task_list);
+
+  for (i = 0; i < nb_tasks; i++)
+    {
+      task = VEC_index (ada_task_info_s, task_list, i);
+      if (!ada_task_is_alive (task))
+        continue;
+      iterator (task);
+    }
+}
+
 /* Extract the contents of the value as a string whose length is LENGTH,
    and store the result in DEST.  */
 
This page took 0.027531 seconds and 4 git commands to generate.