Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH 1/2] [Ada] Add ada-tasks.c:iterate_over_live_ada_tasks
Date: Thu, 23 Sep 2010 19:44:00 -0000	[thread overview]
Message-ID: <1285267380-8329-2-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1285267380-8329-1-git-send-email-brobecker@adacore.com>

This new function is needed by the ravenscar-thread layer.

gdb/ChangeLog:

        * ada-tasks.c (iterate_over_live_ada_tasks): New function.
        * ada-lang.h (iterate_over_live_ada_tasks): Declare.
---
 gdb/ada-lang.h  |    4 ++++
 gdb/ada-tasks.c |   21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index d1e8ca5..935c2e1 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -378,6 +378,10 @@ extern int valid_task_id (int);
 
 extern int ada_get_task_number (ptid_t);
 
+typedef void (ada_task_list_iterator_ftype) (struct ada_task_info *task);
+extern void iterate_over_live_ada_tasks
+  (ada_task_list_iterator_ftype *iterator);
+
 extern int ada_build_task_list (int warn_if_null);
 
 extern int ada_exception_catchpoint_p (struct breakpoint *b);
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 8e42252..3cbcc4f 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -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.  */
 
-- 
1.7.1


  reply	other threads:[~2010-09-23 18:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 19:01 Add support for GNAT Ravenscar run-time library Joel Brobecker
2010-09-23 19:44 ` Joel Brobecker [this message]
2010-09-29  3:25   ` [PATCH 1/2] [Ada] Add ada-tasks.c:iterate_over_live_ada_tasks Joel Brobecker
2010-09-23 19:49 ` [PATCH 2/2] Add support for GNAT Ravenscar run-time library Joel Brobecker
2010-09-23 21:56   ` Joel Brobecker
2010-09-23 21:58   ` Jan Kratochvil
2010-09-23 22:09   ` Pedro Alves
2010-09-23 23:39     ` Joel Brobecker
2010-09-24  1:39       ` Pedro Alves
2010-09-27 18:59         ` Joel Brobecker
2010-09-27 19:01           ` Pedro Alves
2010-09-28 14:55             ` Joel Brobecker
2010-09-29  9:52               ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285267380-8329-2-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox