annotate gcc/ada/libgnarl/s-tasdeb.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . T A S K I N G . D E B U G --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1997-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNARL is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package encapsulates all direct interfaces to task debugging services
kono
parents:
diff changeset
33 -- that are needed by gdb with gnat mode.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 with System.Tasking;
kono
parents:
diff changeset
36 with System.OS_Interface;
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 package System.Tasking.Debug is
kono
parents:
diff changeset
39 pragma Preelaborate;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 ------------------------------------------
kono
parents:
diff changeset
42 -- Application-level debugging routines --
kono
parents:
diff changeset
43 ------------------------------------------
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 procedure List_Tasks;
kono
parents:
diff changeset
46 -- Print a list of all the known Ada tasks with abbreviated state
kono
parents:
diff changeset
47 -- information, one-per-line, to the standard error file.
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 procedure Print_Current_Task;
kono
parents:
diff changeset
50 -- Write information about current task, in hexadecimal, as one line, to
kono
parents:
diff changeset
51 -- the standard error file.
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 procedure Print_Task_Info (T : Task_Id);
kono
parents:
diff changeset
54 -- Similar to Print_Current_Task, for a given task
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 procedure Set_User_State (Value : Long_Integer);
kono
parents:
diff changeset
57 -- Set user state value in the current task. This state will be displayed
kono
parents:
diff changeset
58 -- when calling List_Tasks or Print_Current_Task. It is useful for setting
kono
parents:
diff changeset
59 -- task specific state.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 function Get_User_State return Long_Integer;
kono
parents:
diff changeset
62 -- Return the user state for the current task
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -------------------------
kono
parents:
diff changeset
65 -- General GDB support --
kono
parents:
diff changeset
66 -------------------------
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 Known_Tasks : array (0 .. 999) of Task_Id := (others => null);
kono
parents:
diff changeset
69 -- Global array of tasks read by gdb, and updated by Create_Task and
kono
parents:
diff changeset
70 -- Finalize_TCB
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 Debug_Event_Activating : constant := 1;
kono
parents:
diff changeset
73 Debug_Event_Run : constant := 2;
kono
parents:
diff changeset
74 Debug_Event_Suspended : constant := 3;
kono
parents:
diff changeset
75 Debug_Event_Preempted : constant := 4;
kono
parents:
diff changeset
76 Debug_Event_Terminated : constant := 5;
kono
parents:
diff changeset
77 Debug_Event_Abort_Terminated : constant := 6;
kono
parents:
diff changeset
78 Debug_Event_Exception_Terminated : constant := 7;
kono
parents:
diff changeset
79 Debug_Event_Rendezvous_Exception : constant := 8;
kono
parents:
diff changeset
80 Debug_Event_Handled : constant := 9;
kono
parents:
diff changeset
81 Debug_Event_Dependents_Exception : constant := 10;
kono
parents:
diff changeset
82 Debug_Event_Handled_Others : constant := 11;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 subtype Event_Kind_Type is Positive range 1 .. 11;
kono
parents:
diff changeset
85 -- Event kinds currently defined for debugging, used globally
kono
parents:
diff changeset
86 -- below and on a per task basis.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 procedure Signal_Debug_Event
kono
parents:
diff changeset
89 (Event_Kind : Event_Kind_Type;
kono
parents:
diff changeset
90 Task_Value : Task_Id);
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 ----------------------------------
kono
parents:
diff changeset
93 -- VxWorks specific GDB support --
kono
parents:
diff changeset
94 ----------------------------------
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 -- Although the following routines are implemented in a target independent
kono
parents:
diff changeset
97 -- manner, only VxWorks currently uses them.
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id);
kono
parents:
diff changeset
100 -- This procedure is used to notify GDB of task's creation. It must be
kono
parents:
diff changeset
101 -- called by the task's creator.
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 procedure Task_Termination_Hook;
kono
parents:
diff changeset
104 -- This procedure is used to notify GDB of task's termination
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
kono
parents:
diff changeset
107 -- Suspend all the tasks except the one whose associated thread is
kono
parents:
diff changeset
108 -- Thread_Self by traversing All_Tasks_List and calling
kono
parents:
diff changeset
109 -- System.Task_Primitives.Operations.Suspend_Task.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id);
kono
parents:
diff changeset
112 -- Resume all the tasks except the one whose associated thread is
kono
parents:
diff changeset
113 -- Thread_Self by traversing All_Tasks_List and calling
kono
parents:
diff changeset
114 -- System.Task_Primitives.Operations.Continue_Task.
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 procedure Stop_All_Tasks_Handler;
kono
parents:
diff changeset
117 -- Stop all the tasks by traversing All_Tasks_List and calling
kono
parents:
diff changeset
118 -- System.Task_Primitives.Operations.Stop_All_Task. This function
kono
parents:
diff changeset
119 -- can be used in an interrupt handler.
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 procedure Stop_All_Tasks;
kono
parents:
diff changeset
122 -- Stop all the tasks by traversing All_Tasks_List and calling
kono
parents:
diff changeset
123 -- System.Task_Primitives.Operations.Stop_Task.
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 procedure Continue_All_Tasks;
kono
parents:
diff changeset
126 -- Continue all the tasks by traversing All_Tasks_List and calling
kono
parents:
diff changeset
127 -- System.Task_Primitives.Operations.Continue_Task.
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 -------------------------------
kono
parents:
diff changeset
130 -- Run-time tracing routines --
kono
parents:
diff changeset
131 -------------------------------
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 procedure Trace
kono
parents:
diff changeset
134 (Self_Id : Task_Id;
kono
parents:
diff changeset
135 Msg : String;
kono
parents:
diff changeset
136 Flag : Character;
kono
parents:
diff changeset
137 Other_Id : Task_Id := null);
kono
parents:
diff changeset
138 -- If traces for Flag are enabled, display on Standard_Error a given
kono
parents:
diff changeset
139 -- message for the current task. Other_Id is an optional second task id
kono
parents:
diff changeset
140 -- to display.
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 procedure Set_Trace
kono
parents:
diff changeset
143 (Flag : Character;
kono
parents:
diff changeset
144 Value : Boolean := True);
kono
parents:
diff changeset
145 -- Enable or disable tracing for Flag. By default, flags in the range
kono
parents:
diff changeset
146 -- 'A' .. 'Z' are disabled, others are enabled.
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 ---------------------------------
kono
parents:
diff changeset
149 -- Hooks for Valgrind/Helgrind --
kono
parents:
diff changeset
150 ---------------------------------
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 procedure Master_Hook
kono
parents:
diff changeset
153 (Dependent : Task_Id;
kono
parents:
diff changeset
154 Parent : Task_Id;
kono
parents:
diff changeset
155 Master_Level : Integer);
kono
parents:
diff changeset
156 -- Indicate to Valgrind/Helgrind that the master of Dependent is
kono
parents:
diff changeset
157 -- Parent + Master_Level.
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 procedure Master_Completed_Hook
kono
parents:
diff changeset
160 (Self_ID : Task_Id;
kono
parents:
diff changeset
161 Master_Level : Integer);
kono
parents:
diff changeset
162 -- Indicate to Valgrind/Helgrind that Self_ID has completed the master
kono
parents:
diff changeset
163 -- Master_Level.
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 end System.Tasking.Debug;