final.c: Use rtx_sequence
[official-gcc.git] / gcc / ada / s-tasdeb.ads
blobe0bd0c1e01a5bac89ce13c497b56b7df818d552c
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-2014, 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 3, or (at your option) any later ver- --
14 -- sion. GNAT 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This package encapsulates all direct interfaces to task debugging services
33 -- that are needed by gdb with gnat mode.
35 with System.Tasking;
36 with System.OS_Interface;
38 package System.Tasking.Debug is
39 pragma Preelaborate;
41 ------------------------------------------
42 -- Application-level debugging routines --
43 ------------------------------------------
45 procedure List_Tasks;
46 -- Print a list of all the known Ada tasks with abbreviated state
47 -- information, one-per-line, to the standard error file.
49 procedure Print_Current_Task;
50 -- Write information about current task, in hexadecimal, as one line, to
51 -- the standard error file.
53 procedure Print_Task_Info (T : Task_Id);
54 -- Similar to Print_Current_Task, for a given task
56 procedure Set_User_State (Value : Long_Integer);
57 -- Set user state value in the current task. This state will be displayed
58 -- when calling List_Tasks or Print_Current_Task. It is useful for setting
59 -- task specific state.
61 function Get_User_State return Long_Integer;
62 -- Return the user state for the current task
64 -------------------------
65 -- General GDB support --
66 -------------------------
68 Known_Tasks : array (0 .. 999) of Task_Id := (others => null);
69 -- Global array of tasks read by gdb, and updated by Create_Task and
70 -- Finalize_TCB
72 Debug_Event_Activating : constant := 1;
73 Debug_Event_Run : constant := 2;
74 Debug_Event_Suspended : constant := 3;
75 Debug_Event_Preempted : constant := 4;
76 Debug_Event_Terminated : constant := 5;
77 Debug_Event_Abort_Terminated : constant := 6;
78 Debug_Event_Exception_Terminated : constant := 7;
79 Debug_Event_Rendezvous_Exception : constant := 8;
80 Debug_Event_Handled : constant := 9;
81 Debug_Event_Dependents_Exception : constant := 10;
82 Debug_Event_Handled_Others : constant := 11;
84 subtype Event_Kind_Type is Positive range 1 .. 11;
85 -- Event kinds currently defined for debugging, used globally
86 -- below and on a per task basis.
88 procedure Signal_Debug_Event
89 (Event_Kind : Event_Kind_Type;
90 Task_Value : Task_Id);
92 ----------------------------------
93 -- VxWorks specific GDB support --
94 ----------------------------------
96 -- Although the following routines are implemented in a target independent
97 -- manner, only VxWorks currently uses them.
99 procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
100 -- This procedure is used to notify GDB of task's creation. It must be
101 -- called by the task's creator.
103 procedure Task_Termination_Hook;
104 -- This procedure is used to notify GDB of task's termination
106 procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
107 -- Suspend all the tasks except the one whose associated thread is
108 -- Thread_Self by traversing All_Tasks_List and calling
109 -- System.Task_Primitives.Operations.Suspend_Task.
111 procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
112 -- Resume all the tasks except the one whose associated thread is
113 -- Thread_Self by traversing All_Tasks_List and calling
114 -- System.Task_Primitives.Operations.Continue_Task.
116 procedure Stop_All_Tasks_Handler;
117 -- Stop all the tasks by traversing All_Tasks_List and calling
118 -- System.Task_Primitives.Operations.Stop_All_Task. This function
119 -- can be used in an interrupt handler.
121 procedure Stop_All_Tasks;
122 -- Stop all the tasks by traversing All_Tasks_List and calling
123 -- System.Task_Primitives.Operations.Stop_Task.
125 procedure Continue_All_Tasks;
126 -- Continue all the tasks by traversing All_Tasks_List and calling
127 -- System.Task_Primitives.Operations.Continue_Task.
129 -------------------------------
130 -- Run-time tracing routines --
131 -------------------------------
133 procedure Trace
134 (Self_Id : Task_Id;
135 Msg : String;
136 Flag : Character;
137 Other_Id : Task_Id := null);
138 -- If traces for Flag are enabled, display on Standard_Error a given
139 -- message for the current task. Other_Id is an optional second task id
140 -- to display.
142 procedure Set_Trace
143 (Flag : Character;
144 Value : Boolean := True);
145 -- Enable or disable tracing for Flag. By default, flags in the range
146 -- 'A' .. 'Z' are disabled, others are enabled.
148 ---------------------------------
149 -- Hooks for Valgrind/Helgrind --
150 ---------------------------------
152 procedure Master_Hook
153 (Dependent : Task_Id;
154 Parent : Task_Id;
155 Master_Level : Integer);
156 -- Indicate to Valgrind/Helgrind that the master of Dependent is
157 -- Parent + Master_Level.
159 procedure Master_Completed_Hook
160 (Self_ID : Task_Id;
161 Master_Level : Integer);
162 -- Indicate to Valgrind/Helgrind that Self_ID has completed the master
163 -- Master_Level.
165 end System.Tasking.Debug;