OSDN Git Service

2007-08-14 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tasdeb.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                  GNAT 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-2007, 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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
37 with System.Tasking;
38 with System.OS_Interface;
39
40 package System.Tasking.Debug is
41    pragma Preelaborate;
42
43    ------------------------------------------
44    -- Application-level debugging routines --
45    ------------------------------------------
46
47    procedure List_Tasks;
48    --  Print a list of all the known Ada tasks with abbreviated state
49    --  information, one-per-line, to the standard error file.
50
51    procedure Print_Current_Task;
52    --  Write information about current task, in hexadecimal, as one line, to
53    --  the standard error file.
54
55    procedure Print_Task_Info (T : Task_Id);
56    --  Similar to Print_Current_Task, for a given task
57
58    procedure Set_User_State (Value : Long_Integer);
59    --  Set user state value in the current task. This state will be displayed
60    --  when calling List_Tasks or Print_Current_Task. It is useful for setting
61    --  task specific state.
62
63    function Get_User_State return Long_Integer;
64    --  Return the user state for the current task.
65
66    -------------------------
67    -- General GDB support --
68    -------------------------
69
70    Known_Tasks : array (0 .. 999) of Task_Id := (others => null);
71    --  Global array of tasks read by gdb, and updated by Create_Task and
72    --  Finalize_TCB
73
74    ----------------------------------
75    -- VxWorks specific GDB support --
76    ----------------------------------
77
78    --  Although the following routines are implemented in a target independent
79    --  manner, only VxWorks currently uses them.
80
81    procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
82    --  This procedure is used to notify GDB of task's creation. It must be
83    --  called by the task's creator.
84
85    procedure Task_Termination_Hook;
86    --  This procedure is used to notify GDB of task's termination
87
88    procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
89    --  Suspend all the tasks except the one whose associated thread is
90    --  Thread_Self by traversing All_Tasks_Lists and calling
91    --  System.Task_Primitives.Operations.Suspend_Task.
92
93    procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
94    --  Resume all the tasks except the one whose associated thread is
95    --  Thread_Self by traversing All_Tasks_Lists and calling
96    --  System.Task_Primitives.Operations.Continue_Task.
97
98    procedure Stop_All_Tasks;
99    --  Stop all the tasks by traversing All_Tasks_Lists and calling
100    --  System.Task_Primitives.Operations.Stop_Task. This function
101    --  can be used in a interrupt handler.
102
103    procedure Continue_All_Tasks;
104    --  Continue all the tasks by traversing All_Tasks_Lists and calling
105    --  System.Task_Primitives.Operations.Continue_Task. This function
106    --  can be used in a interrupt handler.
107
108    -------------------------------
109    -- Run-time tracing routines --
110    -------------------------------
111
112    procedure Trace
113      (Self_Id  : Task_Id;
114       Msg      : String;
115       Flag     : Character;
116       Other_Id : Task_Id := null);
117    --  If traces for Flag are enabled, display on Standard_Error a given
118    --  message for the current task. Other_Id is an optional second task id
119    --  to display.
120
121    procedure Set_Trace
122      (Flag  : Character;
123       Value : Boolean := True);
124    --  Enable or disable tracing for Flag. By default, flags in the range
125    --  'A' .. 'Z' are disabled, others are enabled.
126
127 end System.Tasking.Debug;