1------------------------------------------------------------------------------
2--                                                                          --
3--                 GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS              --
4--                                                                          --
5--                  S Y S T E M . T A S K I N G . D E B U G                 --
6--                                                                          --
7--                                  S p e c                                 --
8--                                                                          --
9--          Copyright (C) 1997-2002, Free Software Foundation, Inc.         --
10--                                                                          --
11-- GNARL is free software; you can  redistribute it  and/or modify it under --
12-- terms of the  GNU General Public License as published  by the Free Soft- --
13-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17-- for  more details.  You should have  received  a copy of the GNU General --
18-- Public License  distributed with GNARL; see file COPYING.  If not, write --
19-- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20-- MA 02111-1307, USA.                                                      --
21--                                                                          --
22-- As a special exception,  if other files  instantiate  generics from this --
23-- unit, or you link  this unit with other files  to produce an executable, --
24-- this  unit  does not  by itself cause  the resulting  executable  to  be --
25-- covered  by the  GNU  General  Public  License.  This exception does not --
26-- however invalidate  any other reasons why  the executable file  might be --
27-- covered by the  GNU Public License.                                      --
28--                                                                          --
29-- GNARL was developed by the GNARL team at Florida State University.       --
30-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
31--                                                                          --
32------------------------------------------------------------------------------
33
34--  This package encapsulates all direct interfaces to task debugging services
35--  that are needed by gdb with gnat mode.
36
37with System.Tasking;
38with System.OS_Interface;
39
40package System.Tasking.Debug is
41
42   ------------------------------------------
43   -- Application-level debugging routines --
44   ------------------------------------------
45
46   procedure List_Tasks;
47   --  Print a list of all the known Ada tasks with abbreviated state
48   --  information, one-per-line, to the standard error file.
49
50   procedure Print_Current_Task;
51   --  Write information about current task, in hexadecimal, as one line, to
52   --  the standard error file.
53
54   procedure Print_Task_Info (T : Task_ID);
55   --  Similar to Print_Current_Task, for a given task.
56
57   procedure Set_User_State (Value : Long_Integer);
58   --  Set user state value in the current task.
59   --  This state will be displayed when calling List_Tasks or
60   --  Print_Current_Task. It is useful for setting task specific state.
61
62   function Get_User_State return Long_Integer;
63   --  Return the user state for the current task.
64
65   -------------------------
66   -- General GDB support --
67   -------------------------
68
69   Known_Tasks : array (0 .. 999) of Task_ID;
70   --  Global array of tasks read by gdb, and updated by
71   --  Create_Task and Finalize_TCB
72
73   ----------------------------------
74   -- VxWorks specific GDB support --
75   ----------------------------------
76
77   --  Although the following routines are implemented in a target independent
78   --  manner, only VxWorks currently uses them.
79
80   procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
81   --  This procedure is used to notify GDB of task's creation.
82   --  It must be called by the task's creator.
83
84   procedure Task_Termination_Hook;
85   --  This procedure is used to notify GDB of task's termination.
86
87   procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
88   --  Suspend all the tasks except the one whose associated thread is
89   --  Thread_Self by traversing All_Tasks_Lists and calling
90   --  System.Task_Primitives.Operations.Suspend_Task.
91
92   procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
93   --  Resume all the tasks except the one whose associated thread is
94   --  Thread_Self by traversing All_Tasks_Lists and calling
95   --  System.Task_Primitives.Operations.Continue_Task.
96
97   -------------------------------
98   -- Run-time tracing routines --
99   -------------------------------
100
101   procedure Trace
102     (Self_Id  : Task_ID;
103      Msg      : String;
104      Flag     : Character;
105      Other_Id : Task_ID := null);
106   --  If traces for Flag are enabled, display on Standard_Error a given
107   --  message for the current task. Other_Id is an optional second task id
108   --  to display.
109
110   procedure Set_Trace
111     (Flag  : Character;
112      Value : Boolean := True);
113   --  Enable or disable tracing for Flag.
114   --  By default, flags in the range 'A' .. 'Z' are disabled, others are
115   --  enabled.
116
117end System.Tasking.Debug;
118