]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/libgnarl/s-tasdeb.ads
[Ada] Bump copyright year
[thirdparty/gcc.git] / gcc / ada / libgnarl / s-tasdeb.ads
CommitLineData
cacbc350
RK
1------------------------------------------------------------------------------
2-- --
3084fecd 3-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
cacbc350
RK
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-- --
4b490c1e 9-- Copyright (C) 1997-2020, Free Software Foundation, Inc. --
cacbc350
RK
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- --
748086b7
JJ
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- --
cacbc350 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
748086b7
JJ
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/>. --
cacbc350 26-- --
71ff80dc 27-- GNARL was developed by the GNARL team at Florida State University. --
fbf5a39b 28-- Extensive contributions were provided by Ada Core Technologies, Inc. --
cacbc350
RK
29-- --
30------------------------------------------------------------------------------
31
32-- This package encapsulates all direct interfaces to task debugging services
fbf5a39b 33-- that are needed by gdb with gnat mode.
cacbc350 34
cacbc350
RK
35with System.Tasking;
36with System.OS_Interface;
37
38package System.Tasking.Debug is
3b91d88e 39 pragma Preelaborate;
cacbc350 40
fbf5a39b
AC
41 ------------------------------------------
42 -- Application-level debugging routines --
43 ------------------------------------------
cacbc350
RK
44
45 procedure List_Tasks;
46 -- Print a list of all the known Ada tasks with abbreviated state
fbf5a39b 47 -- information, one-per-line, to the standard error file.
cacbc350
RK
48
49 procedure Print_Current_Task;
fbf5a39b
AC
50 -- Write information about current task, in hexadecimal, as one line, to
51 -- the standard error file.
52
b5e792e2 53 procedure Print_Task_Info (T : Task_Id);
c9b9ec14 54 -- Similar to Print_Current_Task, for a given task
cacbc350 55
fbf5a39b 56 procedure Set_User_State (Value : Long_Integer);
c9b9ec14
JG
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.
cacbc350 60
fbf5a39b 61 function Get_User_State return Long_Integer;
c5d31169 62 -- Return the user state for the current task
cacbc350 63
fbf5a39b
AC
64 -------------------------
65 -- General GDB support --
66 -------------------------
cacbc350 67
3b91d88e 68 Known_Tasks : array (0 .. 999) of Task_Id := (others => null);
c9b9ec14
JG
69 -- Global array of tasks read by gdb, and updated by Create_Task and
70 -- Finalize_TCB
cacbc350 71
5e44c5ea
DR
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;
83
84 subtype Event_Kind_Type is Positive range 1 .. 11;
85 -- Event kinds currently defined for debugging, used globally
87729e5a 86 -- below and on a per task basis.
5e44c5ea
DR
87
88 procedure Signal_Debug_Event
89 (Event_Kind : Event_Kind_Type;
90 Task_Value : Task_Id);
91
fbf5a39b
AC
92 ----------------------------------
93 -- VxWorks specific GDB support --
94 ----------------------------------
95
96 -- Although the following routines are implemented in a target independent
97 -- manner, only VxWorks currently uses them.
cacbc350 98
fbf5a39b 99 procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
c9b9ec14
JG
100 -- This procedure is used to notify GDB of task's creation. It must be
101 -- called by the task's creator.
fbf5a39b
AC
102
103 procedure Task_Termination_Hook;
c9b9ec14 104 -- This procedure is used to notify GDB of task's termination
cacbc350
RK
105
106 procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
107 -- Suspend all the tasks except the one whose associated thread is
b0c5fdda 108 -- Thread_Self by traversing All_Tasks_List and calling
fbf5a39b 109 -- System.Task_Primitives.Operations.Suspend_Task.
cacbc350
RK
110
111 procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
112 -- Resume all the tasks except the one whose associated thread is
b0c5fdda 113 -- Thread_Self by traversing All_Tasks_List and calling
fbf5a39b 114 -- System.Task_Primitives.Operations.Continue_Task.
cacbc350 115
ed18d858 116 procedure Stop_All_Tasks_Handler;
b0c5fdda 117 -- Stop all the tasks by traversing All_Tasks_List and calling
ed18d858 118 -- System.Task_Primitives.Operations.Stop_All_Task. This function
67ce0d7e 119 -- can be used in an interrupt handler.
c9b9ec14 120
ed18d858 121 procedure Stop_All_Tasks;
b0c5fdda 122 -- Stop all the tasks by traversing All_Tasks_List and calling
ed18d858
JG
123 -- System.Task_Primitives.Operations.Stop_Task.
124
c9b9ec14 125 procedure Continue_All_Tasks;
b0c5fdda 126 -- Continue all the tasks by traversing All_Tasks_List and calling
ed18d858 127 -- System.Task_Primitives.Operations.Continue_Task.
c9b9ec14 128
fbf5a39b
AC
129 -------------------------------
130 -- Run-time tracing routines --
131 -------------------------------
cacbc350 132
fbf5a39b 133 procedure Trace
b5e792e2 134 (Self_Id : Task_Id;
fbf5a39b
AC
135 Msg : String;
136 Flag : Character;
b5e792e2 137 Other_Id : Task_Id := null);
fbf5a39b
AC
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.
141
142 procedure Set_Trace
143 (Flag : Character;
144 Value : Boolean := True);
c9b9ec14
JG
145 -- Enable or disable tracing for Flag. By default, flags in the range
146 -- 'A' .. 'Z' are disabled, others are enabled.
fbf5a39b 147
3fe5cead
AC
148 ---------------------------------
149 -- Hooks for Valgrind/Helgrind --
150 ---------------------------------
151
152 procedure Master_Hook
153 (Dependent : Task_Id;
154 Parent : Task_Id;
155 Master_Level : Integer);
79859568
AC
156 -- Indicate to Valgrind/Helgrind that the master of Dependent is
157 -- Parent + Master_Level.
3fe5cead
AC
158
159 procedure Master_Completed_Hook
160 (Self_ID : Task_Id;
161 Master_Level : Integer);
79859568
AC
162 -- Indicate to Valgrind/Helgrind that Self_ID has completed the master
163 -- Master_Level.
3fe5cead 164
fbf5a39b 165end System.Tasking.Debug;