annotate gcc/ada/libgnat/a-except.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
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 COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- A D A . E X C E P T I O N S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT 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 -- GNAT was originally developed by the GNAT team at New York 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 pragma Style_Checks (All_Checks);
kono
parents:
diff changeset
33 -- No subprogram ordering check, due to logical grouping
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 pragma Polling (Off);
kono
parents:
diff changeset
36 -- We must turn polling off for this unit, because otherwise we get
kono
parents:
diff changeset
37 -- elaboration circularities with System.Exception_Tables.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 with System; use System;
kono
parents:
diff changeset
40 with System.Exceptions; use System.Exceptions;
kono
parents:
diff changeset
41 with System.Exceptions_Debug; use System.Exceptions_Debug;
kono
parents:
diff changeset
42 with System.Standard_Library; use System.Standard_Library;
kono
parents:
diff changeset
43 with System.Soft_Links; use System.Soft_Links;
kono
parents:
diff changeset
44 with System.WCh_Con; use System.WCh_Con;
kono
parents:
diff changeset
45 with System.WCh_StW; use System.WCh_StW;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 pragma Warnings (Off);
kono
parents:
diff changeset
48 -- Suppress complaints about Symbolic not being referenced, and about it not
kono
parents:
diff changeset
49 -- having pragma Preelaborate.
kono
parents:
diff changeset
50 with System.Traceback.Symbolic;
kono
parents:
diff changeset
51 -- Bring Symbolic into the closure. If it is the s-trasym-dwarf.adb version,
kono
parents:
diff changeset
52 -- it will install symbolic tracebacks as the default decorator. Otherwise,
kono
parents:
diff changeset
53 -- symbolic tracebacks are not supported, and we fall back to hexadecimal
kono
parents:
diff changeset
54 -- addresses.
kono
parents:
diff changeset
55 pragma Warnings (On);
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 package body Ada.Exceptions is
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 pragma Suppress (All_Checks);
kono
parents:
diff changeset
60 -- We definitely do not want exceptions occurring within this unit, or
kono
parents:
diff changeset
61 -- we are in big trouble. If an exceptional situation does occur, better
kono
parents:
diff changeset
62 -- that it not be raised, since raising it can cause confusing chaos.
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -----------------------
kono
parents:
diff changeset
65 -- Local Subprograms --
kono
parents:
diff changeset
66 -----------------------
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 -- Note: the exported subprograms in this package body are called directly
kono
parents:
diff changeset
69 -- from C clients using the given external name, even though they are not
kono
parents:
diff changeset
70 -- technically visible in the Ada sense.
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 function Code_Address_For_AAA return System.Address;
kono
parents:
diff changeset
73 function Code_Address_For_ZZZ return System.Address;
kono
parents:
diff changeset
74 -- Return start and end of procedures in this package
kono
parents:
diff changeset
75 --
kono
parents:
diff changeset
76 -- These procedures are used to provide exclusion bounds in
kono
parents:
diff changeset
77 -- calls to Call_Chain at exception raise points from this unit. The
kono
parents:
diff changeset
78 -- purpose is to arrange for the exception tracebacks not to include
kono
parents:
diff changeset
79 -- frames from subprograms involved in the raise process, as these are
kono
parents:
diff changeset
80 -- meaningless from the user's standpoint.
kono
parents:
diff changeset
81 --
kono
parents:
diff changeset
82 -- For these bounds to be meaningful, we need to ensure that the object
kono
parents:
diff changeset
83 -- code for the subprograms involved in processing a raise is located
kono
parents:
diff changeset
84 -- after the object code Code_Address_For_AAA and before the object
kono
parents:
diff changeset
85 -- code Code_Address_For_ZZZ. This will indeed be the case as long as
kono
parents:
diff changeset
86 -- the following rules are respected:
kono
parents:
diff changeset
87 --
kono
parents:
diff changeset
88 -- 1) The bodies of the subprograms involved in processing a raise
kono
parents:
diff changeset
89 -- are located after the body of Code_Address_For_AAA and before the
kono
parents:
diff changeset
90 -- body of Code_Address_For_ZZZ.
kono
parents:
diff changeset
91 --
kono
parents:
diff changeset
92 -- 2) No pragma Inline applies to any of these subprograms, as this
kono
parents:
diff changeset
93 -- could delay the corresponding assembly output until the end of
kono
parents:
diff changeset
94 -- the unit.
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 procedure Call_Chain (Excep : EOA);
kono
parents:
diff changeset
97 -- Store up to Max_Tracebacks in Excep, corresponding to the current
kono
parents:
diff changeset
98 -- call chain.
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 function Image (Index : Integer) return String;
kono
parents:
diff changeset
101 -- Return string image corresponding to Index
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 procedure To_Stderr (S : String);
kono
parents:
diff changeset
104 pragma Export (Ada, To_Stderr, "__gnat_to_stderr");
kono
parents:
diff changeset
105 -- Little routine to output string to stderr that is also used
kono
parents:
diff changeset
106 -- in the tasking run time.
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 procedure To_Stderr (C : Character);
kono
parents:
diff changeset
109 pragma Inline (To_Stderr);
kono
parents:
diff changeset
110 pragma Export (Ada, To_Stderr, "__gnat_to_stderr_char");
kono
parents:
diff changeset
111 -- Little routine to output a character to stderr, used by some of
kono
parents:
diff changeset
112 -- the separate units below.
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 package Exception_Data is
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 -----------------------------------
kono
parents:
diff changeset
117 -- Exception Message Subprograms --
kono
parents:
diff changeset
118 -----------------------------------
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 procedure Set_Exception_C_Msg
kono
parents:
diff changeset
121 (Excep : EOA;
kono
parents:
diff changeset
122 Id : Exception_Id;
kono
parents:
diff changeset
123 Msg1 : System.Address;
kono
parents:
diff changeset
124 Line : Integer := 0;
kono
parents:
diff changeset
125 Column : Integer := 0;
kono
parents:
diff changeset
126 Msg2 : System.Address := System.Null_Address);
kono
parents:
diff changeset
127 -- This routine is called to setup the exception referenced by X
kono
parents:
diff changeset
128 -- to contain the indicated Id value and message. Msg1 is a null
kono
parents:
diff changeset
129 -- terminated string which is generated as the exception message. If
kono
parents:
diff changeset
130 -- line is non-zero, then a colon and the decimal representation of
kono
parents:
diff changeset
131 -- this integer is appended to the message. Ditto for Column. When Msg2
kono
parents:
diff changeset
132 -- is non-null, a space and this additional null terminated string is
kono
parents:
diff changeset
133 -- added to the message.
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 procedure Set_Exception_Msg
kono
parents:
diff changeset
136 (Excep : EOA;
kono
parents:
diff changeset
137 Id : Exception_Id;
kono
parents:
diff changeset
138 Message : String);
kono
parents:
diff changeset
139 -- This routine is called to setup the exception referenced by X
kono
parents:
diff changeset
140 -- to contain the indicated Id value and message. Message is a string
kono
parents:
diff changeset
141 -- which is generated as the exception message.
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 ---------------------------------------
kono
parents:
diff changeset
144 -- Exception Information Subprograms --
kono
parents:
diff changeset
145 ---------------------------------------
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 function Untailored_Exception_Information
kono
parents:
diff changeset
148 (X : Exception_Occurrence) return String;
kono
parents:
diff changeset
149 -- This is used by Stream_Attributes.EO_To_String to convert an
kono
parents:
diff changeset
150 -- Exception_Occurrence to a String for the stream attributes.
kono
parents:
diff changeset
151 -- String_To_EO understands the format, as documented here.
kono
parents:
diff changeset
152 --
kono
parents:
diff changeset
153 -- The format of the string is as follows:
kono
parents:
diff changeset
154 --
kono
parents:
diff changeset
155 -- raised <exception name> : <message>
kono
parents:
diff changeset
156 -- (" : <message>" is present only if Exception_Message is not empty)
kono
parents:
diff changeset
157 -- PID=nnnn (only if nonzero)
kono
parents:
diff changeset
158 -- Call stack traceback locations: (only if at least one location)
kono
parents:
diff changeset
159 -- <0xyyyyyyyy 0xyyyyyyyy ...> (is recorded)
kono
parents:
diff changeset
160 --
kono
parents:
diff changeset
161 -- The lines are separated by a ASCII.LF character.
kono
parents:
diff changeset
162 -- The nnnn is the partition Id given as decimal digits.
kono
parents:
diff changeset
163 -- The 0x... line represents traceback program counter locations, in
kono
parents:
diff changeset
164 -- execution order with the first one being the exception location.
kono
parents:
diff changeset
165 --
kono
parents:
diff changeset
166 -- The Exception_Name and Message lines are omitted in the abort
kono
parents:
diff changeset
167 -- signal case, since this is not really an exception.
kono
parents:
diff changeset
168 --
kono
parents:
diff changeset
169 -- Note: If the format of the generated string is changed, please note
kono
parents:
diff changeset
170 -- that an equivalent modification to the routine String_To_EO must be
kono
parents:
diff changeset
171 -- made to preserve proper functioning of the stream attributes.
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 function Exception_Information (X : Exception_Occurrence) return String;
kono
parents:
diff changeset
174 -- This is the implementation of Ada.Exceptions.Exception_Information,
kono
parents:
diff changeset
175 -- as defined in the Ada RM.
kono
parents:
diff changeset
176 --
kono
parents:
diff changeset
177 -- If no traceback decorator (see GNAT.Exception_Traces) is currently
kono
parents:
diff changeset
178 -- in place, this is the same as Untailored_Exception_Information.
kono
parents:
diff changeset
179 -- Otherwise, the decorator is used to produce a symbolic traceback
kono
parents:
diff changeset
180 -- instead of hexadecimal addresses.
kono
parents:
diff changeset
181 --
kono
parents:
diff changeset
182 -- Note that unlike Untailored_Exception_Information, there is no need
kono
parents:
diff changeset
183 -- to keep the output of Exception_Information stable for streaming
kono
parents:
diff changeset
184 -- purposes, and in fact the output differs across platforms.
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 end Exception_Data;
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 package Exception_Traces is
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 -------------------------------------------------
kono
parents:
diff changeset
191 -- Run-Time Exception Notification Subprograms --
kono
parents:
diff changeset
192 -------------------------------------------------
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 -- These subprograms provide a common run-time interface to trigger the
kono
parents:
diff changeset
195 -- actions required when an exception is about to be propagated (e.g.
kono
parents:
diff changeset
196 -- user specified actions or output of exception information). They are
kono
parents:
diff changeset
197 -- exported to be usable by the Ada exception handling personality
kono
parents:
diff changeset
198 -- routine when the GCC 3 mechanism is used.
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 procedure Notify_Handled_Exception (Excep : EOA);
kono
parents:
diff changeset
201 pragma Export
kono
parents:
diff changeset
202 (C, Notify_Handled_Exception, "__gnat_notify_handled_exception");
kono
parents:
diff changeset
203 -- This routine is called for a handled occurrence is about to be
kono
parents:
diff changeset
204 -- propagated.
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 procedure Notify_Unhandled_Exception (Excep : EOA);
kono
parents:
diff changeset
207 pragma Export
kono
parents:
diff changeset
208 (C, Notify_Unhandled_Exception, "__gnat_notify_unhandled_exception");
kono
parents:
diff changeset
209 -- This routine is called when an unhandled occurrence is about to be
kono
parents:
diff changeset
210 -- propagated.
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 procedure Unhandled_Exception_Terminate (Excep : EOA);
kono
parents:
diff changeset
213 pragma No_Return (Unhandled_Exception_Terminate);
kono
parents:
diff changeset
214 -- This procedure is called to terminate execution following an
kono
parents:
diff changeset
215 -- unhandled exception. The exception information, including
kono
parents:
diff changeset
216 -- traceback if available is output, and execution is then
kono
parents:
diff changeset
217 -- terminated. Note that at the point where this routine is
kono
parents:
diff changeset
218 -- called, the stack has typically been destroyed.
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 end Exception_Traces;
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 package Exception_Propagation is
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 ---------------------------------------
kono
parents:
diff changeset
225 -- Exception Propagation Subprograms --
kono
parents:
diff changeset
226 ---------------------------------------
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 function Allocate_Occurrence return EOA;
kono
parents:
diff changeset
229 -- Allocate an exception occurrence (as well as the machine occurrence)
kono
parents:
diff changeset
230
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
231 procedure Propagate_Exception (Excep : Exception_Occurrence);
111
kono
parents:
diff changeset
232 pragma No_Return (Propagate_Exception);
kono
parents:
diff changeset
233 -- This procedure propagates the exception represented by Excep
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 end Exception_Propagation;
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 package Stream_Attributes is
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 ----------------------------------
kono
parents:
diff changeset
240 -- Stream Attribute Subprograms --
kono
parents:
diff changeset
241 ----------------------------------
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 function EId_To_String (X : Exception_Id) return String;
kono
parents:
diff changeset
244 function String_To_EId (S : String) return Exception_Id;
kono
parents:
diff changeset
245 -- Functions for implementing Exception_Id stream attributes
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 function EO_To_String (X : Exception_Occurrence) return String;
kono
parents:
diff changeset
248 function String_To_EO (S : String) return Exception_Occurrence;
kono
parents:
diff changeset
249 -- Functions for implementing Exception_Occurrence stream
kono
parents:
diff changeset
250 -- attributes
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 end Stream_Attributes;
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 procedure Complete_Occurrence (X : EOA);
kono
parents:
diff changeset
255 -- Finish building the occurrence: save the call chain and notify the
kono
parents:
diff changeset
256 -- debugger.
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 procedure Complete_And_Propagate_Occurrence (X : EOA);
kono
parents:
diff changeset
259 pragma No_Return (Complete_And_Propagate_Occurrence);
kono
parents:
diff changeset
260 -- This is a simple wrapper to Complete_Occurrence and
kono
parents:
diff changeset
261 -- Exception_Propagation.Propagate_Exception.
kono
parents:
diff changeset
262
kono
parents:
diff changeset
263 function Create_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
264 (E : Exception_Id;
kono
parents:
diff changeset
265 M : System.Address) return EOA;
kono
parents:
diff changeset
266 -- Create and build an exception occurrence using exception id E and
kono
parents:
diff changeset
267 -- nul-terminated message M.
kono
parents:
diff changeset
268
kono
parents:
diff changeset
269 function Create_Machine_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
270 (E : Exception_Id;
kono
parents:
diff changeset
271 M : System.Address) return System.Address;
kono
parents:
diff changeset
272 pragma Export (C, Create_Machine_Occurrence_From_Signal_Handler,
kono
parents:
diff changeset
273 "__gnat_create_machine_occurrence_from_signal_handler");
kono
parents:
diff changeset
274 -- Create and build an exception occurrence using exception id E and
kono
parents:
diff changeset
275 -- nul-terminated message M. Return the machine occurrence.
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 procedure Raise_Exception_No_Defer
kono
parents:
diff changeset
278 (E : Exception_Id;
kono
parents:
diff changeset
279 Message : String := "");
kono
parents:
diff changeset
280 pragma Export
kono
parents:
diff changeset
281 (Ada, Raise_Exception_No_Defer,
kono
parents:
diff changeset
282 "ada__exceptions__raise_exception_no_defer");
kono
parents:
diff changeset
283 pragma No_Return (Raise_Exception_No_Defer);
kono
parents:
diff changeset
284 -- Similar to Raise_Exception, but with no abort deferral
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 procedure Raise_With_Msg (E : Exception_Id);
kono
parents:
diff changeset
287 pragma No_Return (Raise_With_Msg);
kono
parents:
diff changeset
288 pragma Export (C, Raise_With_Msg, "__gnat_raise_with_msg");
kono
parents:
diff changeset
289 -- Raises an exception with given exception id value. A message
kono
parents:
diff changeset
290 -- is associated with the raise, and has already been stored in the
kono
parents:
diff changeset
291 -- exception occurrence referenced by the Current_Excep in the TSD.
kono
parents:
diff changeset
292 -- Abort is deferred before the raise call.
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 procedure Raise_With_Location_And_Msg
kono
parents:
diff changeset
295 (E : Exception_Id;
kono
parents:
diff changeset
296 F : System.Address;
kono
parents:
diff changeset
297 L : Integer;
kono
parents:
diff changeset
298 C : Integer := 0;
kono
parents:
diff changeset
299 M : System.Address := System.Null_Address);
kono
parents:
diff changeset
300 pragma No_Return (Raise_With_Location_And_Msg);
kono
parents:
diff changeset
301 -- Raise an exception with given exception id value. A filename and line
kono
parents:
diff changeset
302 -- number is associated with the raise and is stored in the exception
kono
parents:
diff changeset
303 -- occurrence and in addition a column and a string message M may be
kono
parents:
diff changeset
304 -- appended to this (if not null/0).
kono
parents:
diff changeset
305
kono
parents:
diff changeset
306 procedure Raise_Constraint_Error (File : System.Address; Line : Integer);
kono
parents:
diff changeset
307 pragma No_Return (Raise_Constraint_Error);
kono
parents:
diff changeset
308 pragma Export (C, Raise_Constraint_Error, "__gnat_raise_constraint_error");
kono
parents:
diff changeset
309 -- Raise constraint error with file:line information
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311 procedure Raise_Constraint_Error_Msg
kono
parents:
diff changeset
312 (File : System.Address;
kono
parents:
diff changeset
313 Line : Integer;
kono
parents:
diff changeset
314 Column : Integer;
kono
parents:
diff changeset
315 Msg : System.Address);
kono
parents:
diff changeset
316 pragma No_Return (Raise_Constraint_Error_Msg);
kono
parents:
diff changeset
317 pragma Export
kono
parents:
diff changeset
318 (C, Raise_Constraint_Error_Msg, "__gnat_raise_constraint_error_msg");
kono
parents:
diff changeset
319 -- Raise constraint error with file:line:col + msg information
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 procedure Raise_Program_Error (File : System.Address; Line : Integer);
kono
parents:
diff changeset
322 pragma No_Return (Raise_Program_Error);
kono
parents:
diff changeset
323 pragma Export (C, Raise_Program_Error, "__gnat_raise_program_error");
kono
parents:
diff changeset
324 -- Raise program error with file:line information
kono
parents:
diff changeset
325
kono
parents:
diff changeset
326 procedure Raise_Program_Error_Msg
kono
parents:
diff changeset
327 (File : System.Address;
kono
parents:
diff changeset
328 Line : Integer;
kono
parents:
diff changeset
329 Msg : System.Address);
kono
parents:
diff changeset
330 pragma No_Return (Raise_Program_Error_Msg);
kono
parents:
diff changeset
331 pragma Export
kono
parents:
diff changeset
332 (C, Raise_Program_Error_Msg, "__gnat_raise_program_error_msg");
kono
parents:
diff changeset
333 -- Raise program error with file:line + msg information
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 procedure Raise_Storage_Error (File : System.Address; Line : Integer);
kono
parents:
diff changeset
336 pragma No_Return (Raise_Storage_Error);
kono
parents:
diff changeset
337 pragma Export (C, Raise_Storage_Error, "__gnat_raise_storage_error");
kono
parents:
diff changeset
338 -- Raise storage error with file:line information
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 procedure Raise_Storage_Error_Msg
kono
parents:
diff changeset
341 (File : System.Address;
kono
parents:
diff changeset
342 Line : Integer;
kono
parents:
diff changeset
343 Msg : System.Address);
kono
parents:
diff changeset
344 pragma No_Return (Raise_Storage_Error_Msg);
kono
parents:
diff changeset
345 pragma Export
kono
parents:
diff changeset
346 (C, Raise_Storage_Error_Msg, "__gnat_raise_storage_error_msg");
kono
parents:
diff changeset
347 -- Raise storage error with file:line + reason msg information
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 -- The exception raising process and the automatic tracing mechanism rely
kono
parents:
diff changeset
350 -- on some careful use of flags attached to the exception occurrence. The
kono
parents:
diff changeset
351 -- graph below illustrates the relations between the Raise_ subprograms
kono
parents:
diff changeset
352 -- and identifies the points where basic flags such as Exception_Raised
kono
parents:
diff changeset
353 -- are initialized.
kono
parents:
diff changeset
354
kono
parents:
diff changeset
355 -- (i) signs indicate the flags initialization points. R stands for Raise,
kono
parents:
diff changeset
356 -- W for With, and E for Exception.
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 -- R_No_Msg R_E R_Pe R_Ce R_Se
kono
parents:
diff changeset
359 -- | | | | |
kono
parents:
diff changeset
360 -- +--+ +--+ +---+ | +---+
kono
parents:
diff changeset
361 -- | | | | |
kono
parents:
diff changeset
362 -- R_E_No_Defer(i) R_W_Msg(i) R_W_Loc
kono
parents:
diff changeset
363 -- | | | |
kono
parents:
diff changeset
364 -- +------------+ | +-----------+ +--+
kono
parents:
diff changeset
365 -- | | | |
kono
parents:
diff changeset
366 -- | | | Set_E_C_Msg(i)
kono
parents:
diff changeset
367 -- | | |
kono
parents:
diff changeset
368 -- Complete_And_Propagate_Occurrence
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 procedure Reraise;
kono
parents:
diff changeset
371 pragma No_Return (Reraise);
kono
parents:
diff changeset
372 pragma Export (C, Reraise, "__gnat_reraise");
kono
parents:
diff changeset
373 -- Reraises the exception referenced by the Current_Excep field
kono
parents:
diff changeset
374 -- of the TSD (all fields of this exception occurrence are set).
kono
parents:
diff changeset
375 -- Abort is deferred before the reraise operation. Called from
kono
parents:
diff changeset
376 -- System.Tasking.RendezVous.Exceptional_Complete_RendezVous
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 procedure Transfer_Occurrence
kono
parents:
diff changeset
379 (Target : Exception_Occurrence_Access;
kono
parents:
diff changeset
380 Source : Exception_Occurrence);
kono
parents:
diff changeset
381 pragma Export (C, Transfer_Occurrence, "__gnat_transfer_occurrence");
kono
parents:
diff changeset
382 -- Called from s-tasren.adb:Local_Complete_RendezVous and
kono
parents:
diff changeset
383 -- s-tpobop.adb:Exceptional_Complete_Entry_Body to setup Target from
kono
parents:
diff changeset
384 -- Source as an exception to be propagated in the caller task. Target is
kono
parents:
diff changeset
385 -- expected to be a pointer to the fixed TSD occurrence for this task.
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 --------------------------------
kono
parents:
diff changeset
388 -- Run-Time Check Subprograms --
kono
parents:
diff changeset
389 --------------------------------
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 -- These subprograms raise a specific exception with a reason message
kono
parents:
diff changeset
392 -- attached. The parameters are the file name and line number in each
kono
parents:
diff changeset
393 -- case. The names are defined by Exp_Ch11.Get_RT_Exception_Name.
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 procedure Rcheck_CE_Access_Check
kono
parents:
diff changeset
396 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
397 procedure Rcheck_CE_Null_Access_Parameter
kono
parents:
diff changeset
398 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
399 procedure Rcheck_CE_Discriminant_Check
kono
parents:
diff changeset
400 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
401 procedure Rcheck_CE_Divide_By_Zero
kono
parents:
diff changeset
402 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
403 procedure Rcheck_CE_Explicit_Raise
kono
parents:
diff changeset
404 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
405 procedure Rcheck_CE_Index_Check
kono
parents:
diff changeset
406 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
407 procedure Rcheck_CE_Invalid_Data
kono
parents:
diff changeset
408 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
409 procedure Rcheck_CE_Length_Check
kono
parents:
diff changeset
410 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
411 procedure Rcheck_CE_Null_Exception_Id
kono
parents:
diff changeset
412 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
413 procedure Rcheck_CE_Null_Not_Allowed
kono
parents:
diff changeset
414 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
415 procedure Rcheck_CE_Overflow_Check
kono
parents:
diff changeset
416 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
417 procedure Rcheck_CE_Partition_Check
kono
parents:
diff changeset
418 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
419 procedure Rcheck_CE_Range_Check
kono
parents:
diff changeset
420 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
421 procedure Rcheck_CE_Tag_Check
kono
parents:
diff changeset
422 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
423 procedure Rcheck_PE_Access_Before_Elaboration
kono
parents:
diff changeset
424 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
425 procedure Rcheck_PE_Accessibility_Check
kono
parents:
diff changeset
426 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
427 procedure Rcheck_PE_Address_Of_Intrinsic
kono
parents:
diff changeset
428 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
429 procedure Rcheck_PE_Aliased_Parameters
kono
parents:
diff changeset
430 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
431 procedure Rcheck_PE_All_Guards_Closed
kono
parents:
diff changeset
432 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
433 procedure Rcheck_PE_Bad_Predicated_Generic_Type
kono
parents:
diff changeset
434 (File : System.Address; Line : Integer);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
435 procedure Rcheck_PE_Build_In_Place_Mismatch
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
436 (File : System.Address; Line : Integer);
111
kono
parents:
diff changeset
437 procedure Rcheck_PE_Current_Task_In_Entry_Body
kono
parents:
diff changeset
438 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
439 procedure Rcheck_PE_Duplicated_Entry_Address
kono
parents:
diff changeset
440 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
441 procedure Rcheck_PE_Explicit_Raise
kono
parents:
diff changeset
442 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
443 procedure Rcheck_PE_Implicit_Return
kono
parents:
diff changeset
444 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
445 procedure Rcheck_PE_Misaligned_Address_Value
kono
parents:
diff changeset
446 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
447 procedure Rcheck_PE_Missing_Return
kono
parents:
diff changeset
448 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
449 procedure Rcheck_PE_Non_Transportable_Actual
kono
parents:
diff changeset
450 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
451 procedure Rcheck_PE_Overlaid_Controlled_Object
kono
parents:
diff changeset
452 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
453 procedure Rcheck_PE_Potentially_Blocking_Operation
kono
parents:
diff changeset
454 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
455 procedure Rcheck_PE_Stubbed_Subprogram_Called
kono
parents:
diff changeset
456 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
457 procedure Rcheck_PE_Unchecked_Union_Restriction
kono
parents:
diff changeset
458 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
459 procedure Rcheck_SE_Empty_Storage_Pool
kono
parents:
diff changeset
460 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
461 procedure Rcheck_SE_Explicit_Raise
kono
parents:
diff changeset
462 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
463 procedure Rcheck_SE_Infinite_Recursion
kono
parents:
diff changeset
464 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
465 procedure Rcheck_SE_Object_Too_Large
kono
parents:
diff changeset
466 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
467 procedure Rcheck_PE_Stream_Operation_Not_Allowed
kono
parents:
diff changeset
468 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
469 procedure Rcheck_CE_Access_Check_Ext
kono
parents:
diff changeset
470 (File : System.Address; Line, Column : Integer);
kono
parents:
diff changeset
471 procedure Rcheck_CE_Index_Check_Ext
kono
parents:
diff changeset
472 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
473 procedure Rcheck_CE_Invalid_Data_Ext
kono
parents:
diff changeset
474 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
475 procedure Rcheck_CE_Range_Check_Ext
kono
parents:
diff changeset
476 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 procedure Rcheck_PE_Finalize_Raised_Exception
kono
parents:
diff changeset
479 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
480 -- This routine is separated out because it has quite different behavior
kono
parents:
diff changeset
481 -- from the others. This is the "finalize/adjust raised exception". This
kono
parents:
diff changeset
482 -- subprogram is always called with abort deferred, unlike all other
kono
parents:
diff changeset
483 -- Rcheck_* subprograms, it needs to call Raise_Exception_No_Defer.
kono
parents:
diff changeset
484
kono
parents:
diff changeset
485 pragma Export (C, Rcheck_CE_Access_Check,
kono
parents:
diff changeset
486 "__gnat_rcheck_CE_Access_Check");
kono
parents:
diff changeset
487 pragma Export (C, Rcheck_CE_Null_Access_Parameter,
kono
parents:
diff changeset
488 "__gnat_rcheck_CE_Null_Access_Parameter");
kono
parents:
diff changeset
489 pragma Export (C, Rcheck_CE_Discriminant_Check,
kono
parents:
diff changeset
490 "__gnat_rcheck_CE_Discriminant_Check");
kono
parents:
diff changeset
491 pragma Export (C, Rcheck_CE_Divide_By_Zero,
kono
parents:
diff changeset
492 "__gnat_rcheck_CE_Divide_By_Zero");
kono
parents:
diff changeset
493 pragma Export (C, Rcheck_CE_Explicit_Raise,
kono
parents:
diff changeset
494 "__gnat_rcheck_CE_Explicit_Raise");
kono
parents:
diff changeset
495 pragma Export (C, Rcheck_CE_Index_Check,
kono
parents:
diff changeset
496 "__gnat_rcheck_CE_Index_Check");
kono
parents:
diff changeset
497 pragma Export (C, Rcheck_CE_Invalid_Data,
kono
parents:
diff changeset
498 "__gnat_rcheck_CE_Invalid_Data");
kono
parents:
diff changeset
499 pragma Export (C, Rcheck_CE_Length_Check,
kono
parents:
diff changeset
500 "__gnat_rcheck_CE_Length_Check");
kono
parents:
diff changeset
501 pragma Export (C, Rcheck_CE_Null_Exception_Id,
kono
parents:
diff changeset
502 "__gnat_rcheck_CE_Null_Exception_Id");
kono
parents:
diff changeset
503 pragma Export (C, Rcheck_CE_Null_Not_Allowed,
kono
parents:
diff changeset
504 "__gnat_rcheck_CE_Null_Not_Allowed");
kono
parents:
diff changeset
505 pragma Export (C, Rcheck_CE_Overflow_Check,
kono
parents:
diff changeset
506 "__gnat_rcheck_CE_Overflow_Check");
kono
parents:
diff changeset
507 pragma Export (C, Rcheck_CE_Partition_Check,
kono
parents:
diff changeset
508 "__gnat_rcheck_CE_Partition_Check");
kono
parents:
diff changeset
509 pragma Export (C, Rcheck_CE_Range_Check,
kono
parents:
diff changeset
510 "__gnat_rcheck_CE_Range_Check");
kono
parents:
diff changeset
511 pragma Export (C, Rcheck_CE_Tag_Check,
kono
parents:
diff changeset
512 "__gnat_rcheck_CE_Tag_Check");
kono
parents:
diff changeset
513 pragma Export (C, Rcheck_PE_Access_Before_Elaboration,
kono
parents:
diff changeset
514 "__gnat_rcheck_PE_Access_Before_Elaboration");
kono
parents:
diff changeset
515 pragma Export (C, Rcheck_PE_Accessibility_Check,
kono
parents:
diff changeset
516 "__gnat_rcheck_PE_Accessibility_Check");
kono
parents:
diff changeset
517 pragma Export (C, Rcheck_PE_Address_Of_Intrinsic,
kono
parents:
diff changeset
518 "__gnat_rcheck_PE_Address_Of_Intrinsic");
kono
parents:
diff changeset
519 pragma Export (C, Rcheck_PE_Aliased_Parameters,
kono
parents:
diff changeset
520 "__gnat_rcheck_PE_Aliased_Parameters");
kono
parents:
diff changeset
521 pragma Export (C, Rcheck_PE_All_Guards_Closed,
kono
parents:
diff changeset
522 "__gnat_rcheck_PE_All_Guards_Closed");
kono
parents:
diff changeset
523 pragma Export (C, Rcheck_PE_Bad_Predicated_Generic_Type,
kono
parents:
diff changeset
524 "__gnat_rcheck_PE_Bad_Predicated_Generic_Type");
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
525 pragma Export (C, Rcheck_PE_Build_In_Place_Mismatch,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
526 "__gnat_rcheck_PE_Build_In_Place_Mismatch");
111
kono
parents:
diff changeset
527 pragma Export (C, Rcheck_PE_Current_Task_In_Entry_Body,
kono
parents:
diff changeset
528 "__gnat_rcheck_PE_Current_Task_In_Entry_Body");
kono
parents:
diff changeset
529 pragma Export (C, Rcheck_PE_Duplicated_Entry_Address,
kono
parents:
diff changeset
530 "__gnat_rcheck_PE_Duplicated_Entry_Address");
kono
parents:
diff changeset
531 pragma Export (C, Rcheck_PE_Explicit_Raise,
kono
parents:
diff changeset
532 "__gnat_rcheck_PE_Explicit_Raise");
kono
parents:
diff changeset
533 pragma Export (C, Rcheck_PE_Finalize_Raised_Exception,
kono
parents:
diff changeset
534 "__gnat_rcheck_PE_Finalize_Raised_Exception");
kono
parents:
diff changeset
535 pragma Export (C, Rcheck_PE_Implicit_Return,
kono
parents:
diff changeset
536 "__gnat_rcheck_PE_Implicit_Return");
kono
parents:
diff changeset
537 pragma Export (C, Rcheck_PE_Misaligned_Address_Value,
kono
parents:
diff changeset
538 "__gnat_rcheck_PE_Misaligned_Address_Value");
kono
parents:
diff changeset
539 pragma Export (C, Rcheck_PE_Missing_Return,
kono
parents:
diff changeset
540 "__gnat_rcheck_PE_Missing_Return");
kono
parents:
diff changeset
541 pragma Export (C, Rcheck_PE_Non_Transportable_Actual,
kono
parents:
diff changeset
542 "__gnat_rcheck_PE_Non_Transportable_Actual");
kono
parents:
diff changeset
543 pragma Export (C, Rcheck_PE_Overlaid_Controlled_Object,
kono
parents:
diff changeset
544 "__gnat_rcheck_PE_Overlaid_Controlled_Object");
kono
parents:
diff changeset
545 pragma Export (C, Rcheck_PE_Potentially_Blocking_Operation,
kono
parents:
diff changeset
546 "__gnat_rcheck_PE_Potentially_Blocking_Operation");
kono
parents:
diff changeset
547 pragma Export (C, Rcheck_PE_Stream_Operation_Not_Allowed,
kono
parents:
diff changeset
548 "__gnat_rcheck_PE_Stream_Operation_Not_Allowed");
kono
parents:
diff changeset
549 pragma Export (C, Rcheck_PE_Stubbed_Subprogram_Called,
kono
parents:
diff changeset
550 "__gnat_rcheck_PE_Stubbed_Subprogram_Called");
kono
parents:
diff changeset
551 pragma Export (C, Rcheck_PE_Unchecked_Union_Restriction,
kono
parents:
diff changeset
552 "__gnat_rcheck_PE_Unchecked_Union_Restriction");
kono
parents:
diff changeset
553 pragma Export (C, Rcheck_SE_Empty_Storage_Pool,
kono
parents:
diff changeset
554 "__gnat_rcheck_SE_Empty_Storage_Pool");
kono
parents:
diff changeset
555 pragma Export (C, Rcheck_SE_Explicit_Raise,
kono
parents:
diff changeset
556 "__gnat_rcheck_SE_Explicit_Raise");
kono
parents:
diff changeset
557 pragma Export (C, Rcheck_SE_Infinite_Recursion,
kono
parents:
diff changeset
558 "__gnat_rcheck_SE_Infinite_Recursion");
kono
parents:
diff changeset
559 pragma Export (C, Rcheck_SE_Object_Too_Large,
kono
parents:
diff changeset
560 "__gnat_rcheck_SE_Object_Too_Large");
kono
parents:
diff changeset
561
kono
parents:
diff changeset
562 pragma Export (C, Rcheck_CE_Access_Check_Ext,
kono
parents:
diff changeset
563 "__gnat_rcheck_CE_Access_Check_ext");
kono
parents:
diff changeset
564 pragma Export (C, Rcheck_CE_Index_Check_Ext,
kono
parents:
diff changeset
565 "__gnat_rcheck_CE_Index_Check_ext");
kono
parents:
diff changeset
566 pragma Export (C, Rcheck_CE_Invalid_Data_Ext,
kono
parents:
diff changeset
567 "__gnat_rcheck_CE_Invalid_Data_ext");
kono
parents:
diff changeset
568 pragma Export (C, Rcheck_CE_Range_Check_Ext,
kono
parents:
diff changeset
569 "__gnat_rcheck_CE_Range_Check_ext");
kono
parents:
diff changeset
570
kono
parents:
diff changeset
571 -- None of these procedures ever returns (they raise an exception). By
kono
parents:
diff changeset
572 -- using pragma No_Return, we ensure that any junk code after the call,
kono
parents:
diff changeset
573 -- such as normal return epilogue stuff, can be eliminated).
kono
parents:
diff changeset
574
kono
parents:
diff changeset
575 pragma No_Return (Rcheck_CE_Access_Check);
kono
parents:
diff changeset
576 pragma No_Return (Rcheck_CE_Null_Access_Parameter);
kono
parents:
diff changeset
577 pragma No_Return (Rcheck_CE_Discriminant_Check);
kono
parents:
diff changeset
578 pragma No_Return (Rcheck_CE_Divide_By_Zero);
kono
parents:
diff changeset
579 pragma No_Return (Rcheck_CE_Explicit_Raise);
kono
parents:
diff changeset
580 pragma No_Return (Rcheck_CE_Index_Check);
kono
parents:
diff changeset
581 pragma No_Return (Rcheck_CE_Invalid_Data);
kono
parents:
diff changeset
582 pragma No_Return (Rcheck_CE_Length_Check);
kono
parents:
diff changeset
583 pragma No_Return (Rcheck_CE_Null_Exception_Id);
kono
parents:
diff changeset
584 pragma No_Return (Rcheck_CE_Null_Not_Allowed);
kono
parents:
diff changeset
585 pragma No_Return (Rcheck_CE_Overflow_Check);
kono
parents:
diff changeset
586 pragma No_Return (Rcheck_CE_Partition_Check);
kono
parents:
diff changeset
587 pragma No_Return (Rcheck_CE_Range_Check);
kono
parents:
diff changeset
588 pragma No_Return (Rcheck_CE_Tag_Check);
kono
parents:
diff changeset
589 pragma No_Return (Rcheck_PE_Access_Before_Elaboration);
kono
parents:
diff changeset
590 pragma No_Return (Rcheck_PE_Accessibility_Check);
kono
parents:
diff changeset
591 pragma No_Return (Rcheck_PE_Address_Of_Intrinsic);
kono
parents:
diff changeset
592 pragma No_Return (Rcheck_PE_Aliased_Parameters);
kono
parents:
diff changeset
593 pragma No_Return (Rcheck_PE_All_Guards_Closed);
kono
parents:
diff changeset
594 pragma No_Return (Rcheck_PE_Bad_Predicated_Generic_Type);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
595 pragma No_Return (Rcheck_PE_Build_In_Place_Mismatch);
111
kono
parents:
diff changeset
596 pragma No_Return (Rcheck_PE_Current_Task_In_Entry_Body);
kono
parents:
diff changeset
597 pragma No_Return (Rcheck_PE_Duplicated_Entry_Address);
kono
parents:
diff changeset
598 pragma No_Return (Rcheck_PE_Explicit_Raise);
kono
parents:
diff changeset
599 pragma No_Return (Rcheck_PE_Implicit_Return);
kono
parents:
diff changeset
600 pragma No_Return (Rcheck_PE_Misaligned_Address_Value);
kono
parents:
diff changeset
601 pragma No_Return (Rcheck_PE_Missing_Return);
kono
parents:
diff changeset
602 pragma No_Return (Rcheck_PE_Non_Transportable_Actual);
kono
parents:
diff changeset
603 pragma No_Return (Rcheck_PE_Overlaid_Controlled_Object);
kono
parents:
diff changeset
604 pragma No_Return (Rcheck_PE_Potentially_Blocking_Operation);
kono
parents:
diff changeset
605 pragma No_Return (Rcheck_PE_Stream_Operation_Not_Allowed);
kono
parents:
diff changeset
606 pragma No_Return (Rcheck_PE_Stubbed_Subprogram_Called);
kono
parents:
diff changeset
607 pragma No_Return (Rcheck_PE_Unchecked_Union_Restriction);
kono
parents:
diff changeset
608 pragma No_Return (Rcheck_PE_Finalize_Raised_Exception);
kono
parents:
diff changeset
609 pragma No_Return (Rcheck_SE_Empty_Storage_Pool);
kono
parents:
diff changeset
610 pragma No_Return (Rcheck_SE_Explicit_Raise);
kono
parents:
diff changeset
611 pragma No_Return (Rcheck_SE_Infinite_Recursion);
kono
parents:
diff changeset
612 pragma No_Return (Rcheck_SE_Object_Too_Large);
kono
parents:
diff changeset
613
kono
parents:
diff changeset
614 pragma No_Return (Rcheck_CE_Access_Check_Ext);
kono
parents:
diff changeset
615 pragma No_Return (Rcheck_CE_Index_Check_Ext);
kono
parents:
diff changeset
616 pragma No_Return (Rcheck_CE_Invalid_Data_Ext);
kono
parents:
diff changeset
617 pragma No_Return (Rcheck_CE_Range_Check_Ext);
kono
parents:
diff changeset
618
kono
parents:
diff changeset
619 ---------------------------------------------
kono
parents:
diff changeset
620 -- Reason Strings for Run-Time Check Calls --
kono
parents:
diff changeset
621 ---------------------------------------------
kono
parents:
diff changeset
622
kono
parents:
diff changeset
623 -- These strings are null-terminated and are used by Rcheck_nn. The
kono
parents:
diff changeset
624 -- strings correspond to the definitions for Types.RT_Exception_Code.
kono
parents:
diff changeset
625
kono
parents:
diff changeset
626 use ASCII;
kono
parents:
diff changeset
627
kono
parents:
diff changeset
628 Rmsg_00 : constant String := "access check failed" & NUL;
kono
parents:
diff changeset
629 Rmsg_01 : constant String := "access parameter is null" & NUL;
kono
parents:
diff changeset
630 Rmsg_02 : constant String := "discriminant check failed" & NUL;
kono
parents:
diff changeset
631 Rmsg_03 : constant String := "divide by zero" & NUL;
kono
parents:
diff changeset
632 Rmsg_04 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
633 Rmsg_05 : constant String := "index check failed" & NUL;
kono
parents:
diff changeset
634 Rmsg_06 : constant String := "invalid data" & NUL;
kono
parents:
diff changeset
635 Rmsg_07 : constant String := "length check failed" & NUL;
kono
parents:
diff changeset
636 Rmsg_08 : constant String := "null Exception_Id" & NUL;
kono
parents:
diff changeset
637 Rmsg_09 : constant String := "null-exclusion check failed" & NUL;
kono
parents:
diff changeset
638 Rmsg_10 : constant String := "overflow check failed" & NUL;
kono
parents:
diff changeset
639 Rmsg_11 : constant String := "partition check failed" & NUL;
kono
parents:
diff changeset
640 Rmsg_12 : constant String := "range check failed" & NUL;
kono
parents:
diff changeset
641 Rmsg_13 : constant String := "tag check failed" & NUL;
kono
parents:
diff changeset
642 Rmsg_14 : constant String := "access before elaboration" & NUL;
kono
parents:
diff changeset
643 Rmsg_15 : constant String := "accessibility check failed" & NUL;
kono
parents:
diff changeset
644 Rmsg_16 : constant String := "attempt to take address of" &
kono
parents:
diff changeset
645 " intrinsic subprogram" & NUL;
kono
parents:
diff changeset
646 Rmsg_17 : constant String := "aliased parameters" & NUL;
kono
parents:
diff changeset
647 Rmsg_18 : constant String := "all guards closed" & NUL;
kono
parents:
diff changeset
648 Rmsg_19 : constant String := "improper use of generic subtype" &
kono
parents:
diff changeset
649 " with predicate" & NUL;
kono
parents:
diff changeset
650 Rmsg_20 : constant String := "Current_Task referenced in entry" &
kono
parents:
diff changeset
651 " body" & NUL;
kono
parents:
diff changeset
652 Rmsg_21 : constant String := "duplicated entry address" & NUL;
kono
parents:
diff changeset
653 Rmsg_22 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
654 Rmsg_23 : constant String := "finalize/adjust raised exception" & NUL;
kono
parents:
diff changeset
655 Rmsg_24 : constant String := "implicit return with No_Return" & NUL;
kono
parents:
diff changeset
656 Rmsg_25 : constant String := "misaligned address value" & NUL;
kono
parents:
diff changeset
657 Rmsg_26 : constant String := "missing return" & NUL;
kono
parents:
diff changeset
658 Rmsg_27 : constant String := "overlaid controlled object" & NUL;
kono
parents:
diff changeset
659 Rmsg_28 : constant String := "potentially blocking operation" & NUL;
kono
parents:
diff changeset
660 Rmsg_29 : constant String := "stubbed subprogram called" & NUL;
kono
parents:
diff changeset
661 Rmsg_30 : constant String := "unchecked union restriction" & NUL;
kono
parents:
diff changeset
662 Rmsg_31 : constant String := "actual/returned class-wide" &
kono
parents:
diff changeset
663 " value not transportable" & NUL;
kono
parents:
diff changeset
664 Rmsg_32 : constant String := "empty storage pool" & NUL;
kono
parents:
diff changeset
665 Rmsg_33 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
666 Rmsg_34 : constant String := "infinite recursion" & NUL;
kono
parents:
diff changeset
667 Rmsg_35 : constant String := "object too large" & NUL;
kono
parents:
diff changeset
668 Rmsg_36 : constant String := "stream operation not allowed" & NUL;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
669 Rmsg_37 : constant String := "build-in-place mismatch" & NUL;
111
kono
parents:
diff changeset
670
kono
parents:
diff changeset
671 -----------------------
kono
parents:
diff changeset
672 -- Polling Interface --
kono
parents:
diff changeset
673 -----------------------
kono
parents:
diff changeset
674
kono
parents:
diff changeset
675 type Unsigned is mod 2 ** 32;
kono
parents:
diff changeset
676
kono
parents:
diff changeset
677 Counter : Unsigned := 0;
kono
parents:
diff changeset
678 pragma Warnings (Off, Counter);
kono
parents:
diff changeset
679 -- This counter is provided for convenience. It can be used in Poll to
kono
parents:
diff changeset
680 -- perform periodic but not systematic operations.
kono
parents:
diff changeset
681
kono
parents:
diff changeset
682 procedure Poll is separate;
kono
parents:
diff changeset
683 -- The actual polling routine is separate, so that it can easily be
kono
parents:
diff changeset
684 -- replaced with a target dependent version.
kono
parents:
diff changeset
685
kono
parents:
diff changeset
686 --------------------------
kono
parents:
diff changeset
687 -- Code_Address_For_AAA --
kono
parents:
diff changeset
688 --------------------------
kono
parents:
diff changeset
689
kono
parents:
diff changeset
690 -- This function gives us the start of the PC range for addresses within
kono
parents:
diff changeset
691 -- the exception unit itself. We hope that gigi/gcc keep all the procedures
kono
parents:
diff changeset
692 -- in their original order.
kono
parents:
diff changeset
693
kono
parents:
diff changeset
694 function Code_Address_For_AAA return System.Address is
kono
parents:
diff changeset
695 begin
kono
parents:
diff changeset
696 -- We are using a label instead of Code_Address_For_AAA'Address because
kono
parents:
diff changeset
697 -- on some platforms the latter does not yield the address we want, but
kono
parents:
diff changeset
698 -- the address of a stub or of a descriptor instead. This is the case at
kono
parents:
diff changeset
699 -- least on PA-HPUX.
kono
parents:
diff changeset
700
kono
parents:
diff changeset
701 <<Start_Of_AAA>>
kono
parents:
diff changeset
702 return Start_Of_AAA'Address;
kono
parents:
diff changeset
703 end Code_Address_For_AAA;
kono
parents:
diff changeset
704
kono
parents:
diff changeset
705 ----------------
kono
parents:
diff changeset
706 -- Call_Chain --
kono
parents:
diff changeset
707 ----------------
kono
parents:
diff changeset
708
kono
parents:
diff changeset
709 procedure Call_Chain (Excep : EOA) is separate;
kono
parents:
diff changeset
710 -- The actual Call_Chain routine is separate, so that it can easily
kono
parents:
diff changeset
711 -- be dummied out when no exception traceback information is needed.
kono
parents:
diff changeset
712
kono
parents:
diff changeset
713 -------------------
kono
parents:
diff changeset
714 -- EId_To_String --
kono
parents:
diff changeset
715 -------------------
kono
parents:
diff changeset
716
kono
parents:
diff changeset
717 function EId_To_String (X : Exception_Id) return String
kono
parents:
diff changeset
718 renames Stream_Attributes.EId_To_String;
kono
parents:
diff changeset
719
kono
parents:
diff changeset
720 ------------------
kono
parents:
diff changeset
721 -- EO_To_String --
kono
parents:
diff changeset
722 ------------------
kono
parents:
diff changeset
723
kono
parents:
diff changeset
724 -- We use the null string to represent the null occurrence, otherwise we
kono
parents:
diff changeset
725 -- output the Untailored_Exception_Information string for the occurrence.
kono
parents:
diff changeset
726
kono
parents:
diff changeset
727 function EO_To_String (X : Exception_Occurrence) return String
kono
parents:
diff changeset
728 renames Stream_Attributes.EO_To_String;
kono
parents:
diff changeset
729
kono
parents:
diff changeset
730 ------------------------
kono
parents:
diff changeset
731 -- Exception_Identity --
kono
parents:
diff changeset
732 ------------------------
kono
parents:
diff changeset
733
kono
parents:
diff changeset
734 function Exception_Identity
kono
parents:
diff changeset
735 (X : Exception_Occurrence) return Exception_Id
kono
parents:
diff changeset
736 is
kono
parents:
diff changeset
737 begin
kono
parents:
diff changeset
738 -- Note that the following test used to be here for the original
kono
parents:
diff changeset
739 -- Ada 95 semantics, but these were modified by AI-241 to require
kono
parents:
diff changeset
740 -- returning Null_Id instead of raising Constraint_Error.
kono
parents:
diff changeset
741
kono
parents:
diff changeset
742 -- if X.Id = Null_Id then
kono
parents:
diff changeset
743 -- raise Constraint_Error;
kono
parents:
diff changeset
744 -- end if;
kono
parents:
diff changeset
745
kono
parents:
diff changeset
746 return X.Id;
kono
parents:
diff changeset
747 end Exception_Identity;
kono
parents:
diff changeset
748
kono
parents:
diff changeset
749 ---------------------------
kono
parents:
diff changeset
750 -- Exception_Information --
kono
parents:
diff changeset
751 ---------------------------
kono
parents:
diff changeset
752
kono
parents:
diff changeset
753 function Exception_Information (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
754 begin
kono
parents:
diff changeset
755 if X.Id = Null_Id then
kono
parents:
diff changeset
756 raise Constraint_Error;
kono
parents:
diff changeset
757 else
kono
parents:
diff changeset
758 return Exception_Data.Exception_Information (X);
kono
parents:
diff changeset
759 end if;
kono
parents:
diff changeset
760 end Exception_Information;
kono
parents:
diff changeset
761
kono
parents:
diff changeset
762 -----------------------
kono
parents:
diff changeset
763 -- Exception_Message --
kono
parents:
diff changeset
764 -----------------------
kono
parents:
diff changeset
765
kono
parents:
diff changeset
766 function Exception_Message (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
767 begin
kono
parents:
diff changeset
768 if X.Id = Null_Id then
kono
parents:
diff changeset
769 raise Constraint_Error;
kono
parents:
diff changeset
770 else
kono
parents:
diff changeset
771 return X.Msg (1 .. X.Msg_Length);
kono
parents:
diff changeset
772 end if;
kono
parents:
diff changeset
773 end Exception_Message;
kono
parents:
diff changeset
774
kono
parents:
diff changeset
775 --------------------
kono
parents:
diff changeset
776 -- Exception_Name --
kono
parents:
diff changeset
777 --------------------
kono
parents:
diff changeset
778
kono
parents:
diff changeset
779 function Exception_Name (Id : Exception_Id) return String is
kono
parents:
diff changeset
780 begin
kono
parents:
diff changeset
781 if Id = null then
kono
parents:
diff changeset
782 raise Constraint_Error;
kono
parents:
diff changeset
783 else
kono
parents:
diff changeset
784 return To_Ptr (Id.Full_Name) (1 .. Id.Name_Length - 1);
kono
parents:
diff changeset
785 end if;
kono
parents:
diff changeset
786 end Exception_Name;
kono
parents:
diff changeset
787
kono
parents:
diff changeset
788 function Exception_Name (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
789 begin
kono
parents:
diff changeset
790 return Exception_Name (X.Id);
kono
parents:
diff changeset
791 end Exception_Name;
kono
parents:
diff changeset
792
kono
parents:
diff changeset
793 ---------------------------
kono
parents:
diff changeset
794 -- Exception_Name_Simple --
kono
parents:
diff changeset
795 ---------------------------
kono
parents:
diff changeset
796
kono
parents:
diff changeset
797 function Exception_Name_Simple (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
798 Name : constant String := Exception_Name (X);
kono
parents:
diff changeset
799 P : Natural;
kono
parents:
diff changeset
800
kono
parents:
diff changeset
801 begin
kono
parents:
diff changeset
802 P := Name'Length;
kono
parents:
diff changeset
803 while P > 1 loop
kono
parents:
diff changeset
804 exit when Name (P - 1) = '.';
kono
parents:
diff changeset
805 P := P - 1;
kono
parents:
diff changeset
806 end loop;
kono
parents:
diff changeset
807
kono
parents:
diff changeset
808 -- Return result making sure lower bound is 1
kono
parents:
diff changeset
809
kono
parents:
diff changeset
810 declare
kono
parents:
diff changeset
811 subtype Rname is String (1 .. Name'Length - P + 1);
kono
parents:
diff changeset
812 begin
kono
parents:
diff changeset
813 return Rname (Name (P .. Name'Length));
kono
parents:
diff changeset
814 end;
kono
parents:
diff changeset
815 end Exception_Name_Simple;
kono
parents:
diff changeset
816
kono
parents:
diff changeset
817 --------------------
kono
parents:
diff changeset
818 -- Exception_Data --
kono
parents:
diff changeset
819 --------------------
kono
parents:
diff changeset
820
kono
parents:
diff changeset
821 package body Exception_Data is separate;
kono
parents:
diff changeset
822 -- This package can be easily dummied out if we do not want the basic
kono
parents:
diff changeset
823 -- support for exception messages (such as in Ada 83).
kono
parents:
diff changeset
824
kono
parents:
diff changeset
825 ---------------------------
kono
parents:
diff changeset
826 -- Exception_Propagation --
kono
parents:
diff changeset
827 ---------------------------
kono
parents:
diff changeset
828
kono
parents:
diff changeset
829 package body Exception_Propagation is separate;
kono
parents:
diff changeset
830 -- Depending on the actual exception mechanism used (front-end or
kono
parents:
diff changeset
831 -- back-end based), the implementation will differ, which is why this
kono
parents:
diff changeset
832 -- package is separated.
kono
parents:
diff changeset
833
kono
parents:
diff changeset
834 ----------------------
kono
parents:
diff changeset
835 -- Exception_Traces --
kono
parents:
diff changeset
836 ----------------------
kono
parents:
diff changeset
837
kono
parents:
diff changeset
838 package body Exception_Traces is separate;
kono
parents:
diff changeset
839 -- Depending on the underlying support for IO the implementation will
kono
parents:
diff changeset
840 -- differ. Moreover we would like to dummy out this package in case we
kono
parents:
diff changeset
841 -- do not want any exception tracing support. This is why this package
kono
parents:
diff changeset
842 -- is separated.
kono
parents:
diff changeset
843
kono
parents:
diff changeset
844 --------------------------------------
kono
parents:
diff changeset
845 -- Get_Exception_Machine_Occurrence --
kono
parents:
diff changeset
846 --------------------------------------
kono
parents:
diff changeset
847
kono
parents:
diff changeset
848 function Get_Exception_Machine_Occurrence
kono
parents:
diff changeset
849 (X : Exception_Occurrence) return System.Address
kono
parents:
diff changeset
850 is
kono
parents:
diff changeset
851 begin
kono
parents:
diff changeset
852 return X.Machine_Occurrence;
kono
parents:
diff changeset
853 end Get_Exception_Machine_Occurrence;
kono
parents:
diff changeset
854
kono
parents:
diff changeset
855 -----------
kono
parents:
diff changeset
856 -- Image --
kono
parents:
diff changeset
857 -----------
kono
parents:
diff changeset
858
kono
parents:
diff changeset
859 function Image (Index : Integer) return String is
kono
parents:
diff changeset
860 Result : constant String := Integer'Image (Index);
kono
parents:
diff changeset
861 begin
kono
parents:
diff changeset
862 if Result (1) = ' ' then
kono
parents:
diff changeset
863 return Result (2 .. Result'Last);
kono
parents:
diff changeset
864 else
kono
parents:
diff changeset
865 return Result;
kono
parents:
diff changeset
866 end if;
kono
parents:
diff changeset
867 end Image;
kono
parents:
diff changeset
868
kono
parents:
diff changeset
869 -----------------------
kono
parents:
diff changeset
870 -- Stream Attributes --
kono
parents:
diff changeset
871 -----------------------
kono
parents:
diff changeset
872
kono
parents:
diff changeset
873 package body Stream_Attributes is separate;
kono
parents:
diff changeset
874 -- This package can be easily dummied out if we do not want the
kono
parents:
diff changeset
875 -- support for streaming Exception_Ids and Exception_Occurrences.
kono
parents:
diff changeset
876
kono
parents:
diff changeset
877 ----------------------------
kono
parents:
diff changeset
878 -- Raise_Constraint_Error --
kono
parents:
diff changeset
879 ----------------------------
kono
parents:
diff changeset
880
kono
parents:
diff changeset
881 procedure Raise_Constraint_Error (File : System.Address; Line : Integer) is
kono
parents:
diff changeset
882 begin
kono
parents:
diff changeset
883 Raise_With_Location_And_Msg (Constraint_Error_Def'Access, File, Line);
kono
parents:
diff changeset
884 end Raise_Constraint_Error;
kono
parents:
diff changeset
885
kono
parents:
diff changeset
886 --------------------------------
kono
parents:
diff changeset
887 -- Raise_Constraint_Error_Msg --
kono
parents:
diff changeset
888 --------------------------------
kono
parents:
diff changeset
889
kono
parents:
diff changeset
890 procedure Raise_Constraint_Error_Msg
kono
parents:
diff changeset
891 (File : System.Address;
kono
parents:
diff changeset
892 Line : Integer;
kono
parents:
diff changeset
893 Column : Integer;
kono
parents:
diff changeset
894 Msg : System.Address)
kono
parents:
diff changeset
895 is
kono
parents:
diff changeset
896 begin
kono
parents:
diff changeset
897 Raise_With_Location_And_Msg
kono
parents:
diff changeset
898 (Constraint_Error_Def'Access, File, Line, Column, Msg);
kono
parents:
diff changeset
899 end Raise_Constraint_Error_Msg;
kono
parents:
diff changeset
900
kono
parents:
diff changeset
901 -------------------------
kono
parents:
diff changeset
902 -- Complete_Occurrence --
kono
parents:
diff changeset
903 -------------------------
kono
parents:
diff changeset
904
kono
parents:
diff changeset
905 procedure Complete_Occurrence (X : EOA) is
kono
parents:
diff changeset
906 begin
kono
parents:
diff changeset
907 -- Compute the backtrace for this occurrence if the corresponding
kono
parents:
diff changeset
908 -- binder option has been set. Call_Chain takes care of the reraise
kono
parents:
diff changeset
909 -- case.
kono
parents:
diff changeset
910
kono
parents:
diff changeset
911 -- ??? Using Call_Chain here means we are going to walk up the stack
kono
parents:
diff changeset
912 -- once only for backtracing purposes before doing it again for the
kono
parents:
diff changeset
913 -- propagation per se.
kono
parents:
diff changeset
914
kono
parents:
diff changeset
915 -- The first inspection is much lighter, though, as it only requires
kono
parents:
diff changeset
916 -- partial unwinding of each frame. Additionally, although we could use
kono
parents:
diff changeset
917 -- the personality routine to record the addresses while propagating,
kono
parents:
diff changeset
918 -- this method has two drawbacks:
kono
parents:
diff changeset
919
kono
parents:
diff changeset
920 -- 1) the trace is incomplete if the exception is handled since we
kono
parents:
diff changeset
921 -- don't walk past the frame with the handler,
kono
parents:
diff changeset
922
kono
parents:
diff changeset
923 -- and
kono
parents:
diff changeset
924
kono
parents:
diff changeset
925 -- 2) we would miss the frames for which our personality routine is not
kono
parents:
diff changeset
926 -- called, e.g. if C or C++ calls are on the way.
kono
parents:
diff changeset
927
kono
parents:
diff changeset
928 Call_Chain (X);
kono
parents:
diff changeset
929
kono
parents:
diff changeset
930 -- Notify the debugger
kono
parents:
diff changeset
931 Debug_Raise_Exception
kono
parents:
diff changeset
932 (E => SSL.Exception_Data_Ptr (X.Id),
kono
parents:
diff changeset
933 Message => X.Msg (1 .. X.Msg_Length));
kono
parents:
diff changeset
934 end Complete_Occurrence;
kono
parents:
diff changeset
935
kono
parents:
diff changeset
936 ---------------------------------------
kono
parents:
diff changeset
937 -- Complete_And_Propagate_Occurrence --
kono
parents:
diff changeset
938 ---------------------------------------
kono
parents:
diff changeset
939
kono
parents:
diff changeset
940 procedure Complete_And_Propagate_Occurrence (X : EOA) is
kono
parents:
diff changeset
941 begin
kono
parents:
diff changeset
942 Complete_Occurrence (X);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
943 Exception_Propagation.Propagate_Exception (X.all);
111
kono
parents:
diff changeset
944 end Complete_And_Propagate_Occurrence;
kono
parents:
diff changeset
945
kono
parents:
diff changeset
946 ---------------------
kono
parents:
diff changeset
947 -- Raise_Exception --
kono
parents:
diff changeset
948 ---------------------
kono
parents:
diff changeset
949
kono
parents:
diff changeset
950 procedure Raise_Exception
kono
parents:
diff changeset
951 (E : Exception_Id;
kono
parents:
diff changeset
952 Message : String := "")
kono
parents:
diff changeset
953 is
kono
parents:
diff changeset
954 EF : Exception_Id := E;
kono
parents:
diff changeset
955 begin
kono
parents:
diff changeset
956 -- Raise CE if E = Null_ID (AI-446)
kono
parents:
diff changeset
957
kono
parents:
diff changeset
958 if E = null then
kono
parents:
diff changeset
959 EF := Constraint_Error'Identity;
kono
parents:
diff changeset
960 end if;
kono
parents:
diff changeset
961
kono
parents:
diff changeset
962 -- Go ahead and raise appropriate exception
kono
parents:
diff changeset
963
kono
parents:
diff changeset
964 Raise_Exception_Always (EF, Message);
kono
parents:
diff changeset
965 end Raise_Exception;
kono
parents:
diff changeset
966
kono
parents:
diff changeset
967 ----------------------------
kono
parents:
diff changeset
968 -- Raise_Exception_Always --
kono
parents:
diff changeset
969 ----------------------------
kono
parents:
diff changeset
970
kono
parents:
diff changeset
971 procedure Raise_Exception_Always
kono
parents:
diff changeset
972 (E : Exception_Id;
kono
parents:
diff changeset
973 Message : String := "")
kono
parents:
diff changeset
974 is
kono
parents:
diff changeset
975 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
976
kono
parents:
diff changeset
977 begin
kono
parents:
diff changeset
978 Exception_Data.Set_Exception_Msg (X, E, Message);
kono
parents:
diff changeset
979
kono
parents:
diff changeset
980 if not ZCX_By_Default then
kono
parents:
diff changeset
981 Abort_Defer.all;
kono
parents:
diff changeset
982 end if;
kono
parents:
diff changeset
983
kono
parents:
diff changeset
984 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
985 end Raise_Exception_Always;
kono
parents:
diff changeset
986
kono
parents:
diff changeset
987 ------------------------------
kono
parents:
diff changeset
988 -- Raise_Exception_No_Defer --
kono
parents:
diff changeset
989 ------------------------------
kono
parents:
diff changeset
990
kono
parents:
diff changeset
991 procedure Raise_Exception_No_Defer
kono
parents:
diff changeset
992 (E : Exception_Id;
kono
parents:
diff changeset
993 Message : String := "")
kono
parents:
diff changeset
994 is
kono
parents:
diff changeset
995 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
996
kono
parents:
diff changeset
997 begin
kono
parents:
diff changeset
998 Exception_Data.Set_Exception_Msg (X, E, Message);
kono
parents:
diff changeset
999
kono
parents:
diff changeset
1000 -- Do not call Abort_Defer.all, as specified by the spec
kono
parents:
diff changeset
1001
kono
parents:
diff changeset
1002 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
1003 end Raise_Exception_No_Defer;
kono
parents:
diff changeset
1004
kono
parents:
diff changeset
1005 -------------------------------------
kono
parents:
diff changeset
1006 -- Raise_From_Controlled_Operation --
kono
parents:
diff changeset
1007 -------------------------------------
kono
parents:
diff changeset
1008
kono
parents:
diff changeset
1009 procedure Raise_From_Controlled_Operation
kono
parents:
diff changeset
1010 (X : Ada.Exceptions.Exception_Occurrence)
kono
parents:
diff changeset
1011 is
kono
parents:
diff changeset
1012 Prefix : constant String := "adjust/finalize raised ";
kono
parents:
diff changeset
1013 Orig_Msg : constant String := Exception_Message (X);
kono
parents:
diff changeset
1014 Orig_Prefix_Length : constant Natural :=
kono
parents:
diff changeset
1015 Integer'Min (Prefix'Length, Orig_Msg'Length);
kono
parents:
diff changeset
1016
kono
parents:
diff changeset
1017 Orig_Prefix : String renames
kono
parents:
diff changeset
1018 Orig_Msg (Orig_Msg'First .. Orig_Msg'First + Orig_Prefix_Length - 1);
kono
parents:
diff changeset
1019
kono
parents:
diff changeset
1020 begin
kono
parents:
diff changeset
1021 -- Message already has the proper prefix, just re-raise
kono
parents:
diff changeset
1022
kono
parents:
diff changeset
1023 if Orig_Prefix = Prefix then
kono
parents:
diff changeset
1024 Raise_Exception_No_Defer
kono
parents:
diff changeset
1025 (E => Program_Error'Identity,
kono
parents:
diff changeset
1026 Message => Orig_Msg);
kono
parents:
diff changeset
1027
kono
parents:
diff changeset
1028 else
kono
parents:
diff changeset
1029 declare
kono
parents:
diff changeset
1030 New_Msg : constant String := Prefix & Exception_Name (X);
kono
parents:
diff changeset
1031
kono
parents:
diff changeset
1032 begin
kono
parents:
diff changeset
1033 -- No message present, just provide our own
kono
parents:
diff changeset
1034
kono
parents:
diff changeset
1035 if Orig_Msg = "" then
kono
parents:
diff changeset
1036 Raise_Exception_No_Defer
kono
parents:
diff changeset
1037 (E => Program_Error'Identity,
kono
parents:
diff changeset
1038 Message => New_Msg);
kono
parents:
diff changeset
1039
kono
parents:
diff changeset
1040 -- Message present, add informational prefix
kono
parents:
diff changeset
1041
kono
parents:
diff changeset
1042 else
kono
parents:
diff changeset
1043 Raise_Exception_No_Defer
kono
parents:
diff changeset
1044 (E => Program_Error'Identity,
kono
parents:
diff changeset
1045 Message => New_Msg & ": " & Orig_Msg);
kono
parents:
diff changeset
1046 end if;
kono
parents:
diff changeset
1047 end;
kono
parents:
diff changeset
1048 end if;
kono
parents:
diff changeset
1049 end Raise_From_Controlled_Operation;
kono
parents:
diff changeset
1050
kono
parents:
diff changeset
1051 -------------------------------------------
kono
parents:
diff changeset
1052 -- Create_Occurrence_From_Signal_Handler --
kono
parents:
diff changeset
1053 -------------------------------------------
kono
parents:
diff changeset
1054
kono
parents:
diff changeset
1055 function Create_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
1056 (E : Exception_Id;
kono
parents:
diff changeset
1057 M : System.Address) return EOA
kono
parents:
diff changeset
1058 is
kono
parents:
diff changeset
1059 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1060
kono
parents:
diff changeset
1061 begin
kono
parents:
diff changeset
1062 Exception_Data.Set_Exception_C_Msg (X, E, M);
kono
parents:
diff changeset
1063
kono
parents:
diff changeset
1064 if not ZCX_By_Default then
kono
parents:
diff changeset
1065 Abort_Defer.all;
kono
parents:
diff changeset
1066 end if;
kono
parents:
diff changeset
1067
kono
parents:
diff changeset
1068 Complete_Occurrence (X);
kono
parents:
diff changeset
1069 return X;
kono
parents:
diff changeset
1070 end Create_Occurrence_From_Signal_Handler;
kono
parents:
diff changeset
1071
kono
parents:
diff changeset
1072 ---------------------------------------------------
kono
parents:
diff changeset
1073 -- Create_Machine_Occurrence_From_Signal_Handler --
kono
parents:
diff changeset
1074 ---------------------------------------------------
kono
parents:
diff changeset
1075
kono
parents:
diff changeset
1076 function Create_Machine_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
1077 (E : Exception_Id;
kono
parents:
diff changeset
1078 M : System.Address) return System.Address
kono
parents:
diff changeset
1079 is
kono
parents:
diff changeset
1080 begin
kono
parents:
diff changeset
1081 return Create_Occurrence_From_Signal_Handler (E, M).Machine_Occurrence;
kono
parents:
diff changeset
1082 end Create_Machine_Occurrence_From_Signal_Handler;
kono
parents:
diff changeset
1083
kono
parents:
diff changeset
1084 -------------------------------
kono
parents:
diff changeset
1085 -- Raise_From_Signal_Handler --
kono
parents:
diff changeset
1086 -------------------------------
kono
parents:
diff changeset
1087
kono
parents:
diff changeset
1088 procedure Raise_From_Signal_Handler
kono
parents:
diff changeset
1089 (E : Exception_Id;
kono
parents:
diff changeset
1090 M : System.Address)
kono
parents:
diff changeset
1091 is
kono
parents:
diff changeset
1092 begin
kono
parents:
diff changeset
1093 Exception_Propagation.Propagate_Exception
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1094 (Create_Occurrence_From_Signal_Handler (E, M).all);
111
kono
parents:
diff changeset
1095 end Raise_From_Signal_Handler;
kono
parents:
diff changeset
1096
kono
parents:
diff changeset
1097 -------------------------
kono
parents:
diff changeset
1098 -- Raise_Program_Error --
kono
parents:
diff changeset
1099 -------------------------
kono
parents:
diff changeset
1100
kono
parents:
diff changeset
1101 procedure Raise_Program_Error
kono
parents:
diff changeset
1102 (File : System.Address;
kono
parents:
diff changeset
1103 Line : Integer)
kono
parents:
diff changeset
1104 is
kono
parents:
diff changeset
1105 begin
kono
parents:
diff changeset
1106 Raise_With_Location_And_Msg (Program_Error_Def'Access, File, Line);
kono
parents:
diff changeset
1107 end Raise_Program_Error;
kono
parents:
diff changeset
1108
kono
parents:
diff changeset
1109 -----------------------------
kono
parents:
diff changeset
1110 -- Raise_Program_Error_Msg --
kono
parents:
diff changeset
1111 -----------------------------
kono
parents:
diff changeset
1112
kono
parents:
diff changeset
1113 procedure Raise_Program_Error_Msg
kono
parents:
diff changeset
1114 (File : System.Address;
kono
parents:
diff changeset
1115 Line : Integer;
kono
parents:
diff changeset
1116 Msg : System.Address)
kono
parents:
diff changeset
1117 is
kono
parents:
diff changeset
1118 begin
kono
parents:
diff changeset
1119 Raise_With_Location_And_Msg
kono
parents:
diff changeset
1120 (Program_Error_Def'Access, File, Line, M => Msg);
kono
parents:
diff changeset
1121 end Raise_Program_Error_Msg;
kono
parents:
diff changeset
1122
kono
parents:
diff changeset
1123 -------------------------
kono
parents:
diff changeset
1124 -- Raise_Storage_Error --
kono
parents:
diff changeset
1125 -------------------------
kono
parents:
diff changeset
1126
kono
parents:
diff changeset
1127 procedure Raise_Storage_Error
kono
parents:
diff changeset
1128 (File : System.Address;
kono
parents:
diff changeset
1129 Line : Integer)
kono
parents:
diff changeset
1130 is
kono
parents:
diff changeset
1131 begin
kono
parents:
diff changeset
1132 Raise_With_Location_And_Msg (Storage_Error_Def'Access, File, Line);
kono
parents:
diff changeset
1133 end Raise_Storage_Error;
kono
parents:
diff changeset
1134
kono
parents:
diff changeset
1135 -----------------------------
kono
parents:
diff changeset
1136 -- Raise_Storage_Error_Msg --
kono
parents:
diff changeset
1137 -----------------------------
kono
parents:
diff changeset
1138
kono
parents:
diff changeset
1139 procedure Raise_Storage_Error_Msg
kono
parents:
diff changeset
1140 (File : System.Address;
kono
parents:
diff changeset
1141 Line : Integer;
kono
parents:
diff changeset
1142 Msg : System.Address)
kono
parents:
diff changeset
1143 is
kono
parents:
diff changeset
1144 begin
kono
parents:
diff changeset
1145 Raise_With_Location_And_Msg
kono
parents:
diff changeset
1146 (Storage_Error_Def'Access, File, Line, M => Msg);
kono
parents:
diff changeset
1147 end Raise_Storage_Error_Msg;
kono
parents:
diff changeset
1148
kono
parents:
diff changeset
1149 ---------------------------------
kono
parents:
diff changeset
1150 -- Raise_With_Location_And_Msg --
kono
parents:
diff changeset
1151 ---------------------------------
kono
parents:
diff changeset
1152
kono
parents:
diff changeset
1153 procedure Raise_With_Location_And_Msg
kono
parents:
diff changeset
1154 (E : Exception_Id;
kono
parents:
diff changeset
1155 F : System.Address;
kono
parents:
diff changeset
1156 L : Integer;
kono
parents:
diff changeset
1157 C : Integer := 0;
kono
parents:
diff changeset
1158 M : System.Address := System.Null_Address)
kono
parents:
diff changeset
1159 is
kono
parents:
diff changeset
1160 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1161 begin
kono
parents:
diff changeset
1162 Exception_Data.Set_Exception_C_Msg (X, E, F, L, C, M);
kono
parents:
diff changeset
1163
kono
parents:
diff changeset
1164 if not ZCX_By_Default then
kono
parents:
diff changeset
1165 Abort_Defer.all;
kono
parents:
diff changeset
1166 end if;
kono
parents:
diff changeset
1167
kono
parents:
diff changeset
1168 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
1169 end Raise_With_Location_And_Msg;
kono
parents:
diff changeset
1170
kono
parents:
diff changeset
1171 --------------------
kono
parents:
diff changeset
1172 -- Raise_With_Msg --
kono
parents:
diff changeset
1173 --------------------
kono
parents:
diff changeset
1174
kono
parents:
diff changeset
1175 procedure Raise_With_Msg (E : Exception_Id) is
kono
parents:
diff changeset
1176 Excep : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1177 Ex : constant Exception_Occurrence_Access := Get_Current_Excep.all;
kono
parents:
diff changeset
1178 begin
kono
parents:
diff changeset
1179 Excep.Exception_Raised := False;
kono
parents:
diff changeset
1180 Excep.Id := E;
kono
parents:
diff changeset
1181 Excep.Num_Tracebacks := 0;
kono
parents:
diff changeset
1182 Excep.Pid := Local_Partition_ID;
kono
parents:
diff changeset
1183
kono
parents:
diff changeset
1184 -- Copy the message from the current exception
kono
parents:
diff changeset
1185 -- Change the interface to be called with an occurrence ???
kono
parents:
diff changeset
1186
kono
parents:
diff changeset
1187 Excep.Msg_Length := Ex.Msg_Length;
kono
parents:
diff changeset
1188 Excep.Msg (1 .. Excep.Msg_Length) := Ex.Msg (1 .. Ex.Msg_Length);
kono
parents:
diff changeset
1189
kono
parents:
diff changeset
1190 -- The following is a common pattern, should be abstracted
kono
parents:
diff changeset
1191 -- into a procedure call ???
kono
parents:
diff changeset
1192
kono
parents:
diff changeset
1193 if not ZCX_By_Default then
kono
parents:
diff changeset
1194 Abort_Defer.all;
kono
parents:
diff changeset
1195 end if;
kono
parents:
diff changeset
1196
kono
parents:
diff changeset
1197 Complete_And_Propagate_Occurrence (Excep);
kono
parents:
diff changeset
1198 end Raise_With_Msg;
kono
parents:
diff changeset
1199
kono
parents:
diff changeset
1200 -----------------------------------------
kono
parents:
diff changeset
1201 -- Calls to Run-Time Check Subprograms --
kono
parents:
diff changeset
1202 -----------------------------------------
kono
parents:
diff changeset
1203
kono
parents:
diff changeset
1204 procedure Rcheck_CE_Access_Check
kono
parents:
diff changeset
1205 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1206 is
kono
parents:
diff changeset
1207 begin
kono
parents:
diff changeset
1208 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_00'Address);
kono
parents:
diff changeset
1209 end Rcheck_CE_Access_Check;
kono
parents:
diff changeset
1210
kono
parents:
diff changeset
1211 procedure Rcheck_CE_Null_Access_Parameter
kono
parents:
diff changeset
1212 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1213 is
kono
parents:
diff changeset
1214 begin
kono
parents:
diff changeset
1215 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_01'Address);
kono
parents:
diff changeset
1216 end Rcheck_CE_Null_Access_Parameter;
kono
parents:
diff changeset
1217
kono
parents:
diff changeset
1218 procedure Rcheck_CE_Discriminant_Check
kono
parents:
diff changeset
1219 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1220 is
kono
parents:
diff changeset
1221 begin
kono
parents:
diff changeset
1222 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_02'Address);
kono
parents:
diff changeset
1223 end Rcheck_CE_Discriminant_Check;
kono
parents:
diff changeset
1224
kono
parents:
diff changeset
1225 procedure Rcheck_CE_Divide_By_Zero
kono
parents:
diff changeset
1226 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1227 is
kono
parents:
diff changeset
1228 begin
kono
parents:
diff changeset
1229 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_03'Address);
kono
parents:
diff changeset
1230 end Rcheck_CE_Divide_By_Zero;
kono
parents:
diff changeset
1231
kono
parents:
diff changeset
1232 procedure Rcheck_CE_Explicit_Raise
kono
parents:
diff changeset
1233 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1234 is
kono
parents:
diff changeset
1235 begin
kono
parents:
diff changeset
1236 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_04'Address);
kono
parents:
diff changeset
1237 end Rcheck_CE_Explicit_Raise;
kono
parents:
diff changeset
1238
kono
parents:
diff changeset
1239 procedure Rcheck_CE_Index_Check
kono
parents:
diff changeset
1240 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1241 is
kono
parents:
diff changeset
1242 begin
kono
parents:
diff changeset
1243 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_05'Address);
kono
parents:
diff changeset
1244 end Rcheck_CE_Index_Check;
kono
parents:
diff changeset
1245
kono
parents:
diff changeset
1246 procedure Rcheck_CE_Invalid_Data
kono
parents:
diff changeset
1247 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1248 is
kono
parents:
diff changeset
1249 begin
kono
parents:
diff changeset
1250 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_06'Address);
kono
parents:
diff changeset
1251 end Rcheck_CE_Invalid_Data;
kono
parents:
diff changeset
1252
kono
parents:
diff changeset
1253 procedure Rcheck_CE_Length_Check
kono
parents:
diff changeset
1254 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1255 is
kono
parents:
diff changeset
1256 begin
kono
parents:
diff changeset
1257 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_07'Address);
kono
parents:
diff changeset
1258 end Rcheck_CE_Length_Check;
kono
parents:
diff changeset
1259
kono
parents:
diff changeset
1260 procedure Rcheck_CE_Null_Exception_Id
kono
parents:
diff changeset
1261 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1262 is
kono
parents:
diff changeset
1263 begin
kono
parents:
diff changeset
1264 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_08'Address);
kono
parents:
diff changeset
1265 end Rcheck_CE_Null_Exception_Id;
kono
parents:
diff changeset
1266
kono
parents:
diff changeset
1267 procedure Rcheck_CE_Null_Not_Allowed
kono
parents:
diff changeset
1268 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1269 is
kono
parents:
diff changeset
1270 begin
kono
parents:
diff changeset
1271 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_09'Address);
kono
parents:
diff changeset
1272 end Rcheck_CE_Null_Not_Allowed;
kono
parents:
diff changeset
1273
kono
parents:
diff changeset
1274 procedure Rcheck_CE_Overflow_Check
kono
parents:
diff changeset
1275 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1276 is
kono
parents:
diff changeset
1277 begin
kono
parents:
diff changeset
1278 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_10'Address);
kono
parents:
diff changeset
1279 end Rcheck_CE_Overflow_Check;
kono
parents:
diff changeset
1280
kono
parents:
diff changeset
1281 procedure Rcheck_CE_Partition_Check
kono
parents:
diff changeset
1282 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1283 is
kono
parents:
diff changeset
1284 begin
kono
parents:
diff changeset
1285 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_11'Address);
kono
parents:
diff changeset
1286 end Rcheck_CE_Partition_Check;
kono
parents:
diff changeset
1287
kono
parents:
diff changeset
1288 procedure Rcheck_CE_Range_Check
kono
parents:
diff changeset
1289 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1290 is
kono
parents:
diff changeset
1291 begin
kono
parents:
diff changeset
1292 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_12'Address);
kono
parents:
diff changeset
1293 end Rcheck_CE_Range_Check;
kono
parents:
diff changeset
1294
kono
parents:
diff changeset
1295 procedure Rcheck_CE_Tag_Check
kono
parents:
diff changeset
1296 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1297 is
kono
parents:
diff changeset
1298 begin
kono
parents:
diff changeset
1299 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_13'Address);
kono
parents:
diff changeset
1300 end Rcheck_CE_Tag_Check;
kono
parents:
diff changeset
1301
kono
parents:
diff changeset
1302 procedure Rcheck_PE_Access_Before_Elaboration
kono
parents:
diff changeset
1303 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1304 is
kono
parents:
diff changeset
1305 begin
kono
parents:
diff changeset
1306 Raise_Program_Error_Msg (File, Line, Rmsg_14'Address);
kono
parents:
diff changeset
1307 end Rcheck_PE_Access_Before_Elaboration;
kono
parents:
diff changeset
1308
kono
parents:
diff changeset
1309 procedure Rcheck_PE_Accessibility_Check
kono
parents:
diff changeset
1310 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1311 is
kono
parents:
diff changeset
1312 begin
kono
parents:
diff changeset
1313 Raise_Program_Error_Msg (File, Line, Rmsg_15'Address);
kono
parents:
diff changeset
1314 end Rcheck_PE_Accessibility_Check;
kono
parents:
diff changeset
1315
kono
parents:
diff changeset
1316 procedure Rcheck_PE_Address_Of_Intrinsic
kono
parents:
diff changeset
1317 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1318 is
kono
parents:
diff changeset
1319 begin
kono
parents:
diff changeset
1320 Raise_Program_Error_Msg (File, Line, Rmsg_16'Address);
kono
parents:
diff changeset
1321 end Rcheck_PE_Address_Of_Intrinsic;
kono
parents:
diff changeset
1322
kono
parents:
diff changeset
1323 procedure Rcheck_PE_Aliased_Parameters
kono
parents:
diff changeset
1324 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1325 is
kono
parents:
diff changeset
1326 begin
kono
parents:
diff changeset
1327 Raise_Program_Error_Msg (File, Line, Rmsg_17'Address);
kono
parents:
diff changeset
1328 end Rcheck_PE_Aliased_Parameters;
kono
parents:
diff changeset
1329
kono
parents:
diff changeset
1330 procedure Rcheck_PE_All_Guards_Closed
kono
parents:
diff changeset
1331 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1332 is
kono
parents:
diff changeset
1333 begin
kono
parents:
diff changeset
1334 Raise_Program_Error_Msg (File, Line, Rmsg_18'Address);
kono
parents:
diff changeset
1335 end Rcheck_PE_All_Guards_Closed;
kono
parents:
diff changeset
1336
kono
parents:
diff changeset
1337 procedure Rcheck_PE_Bad_Predicated_Generic_Type
kono
parents:
diff changeset
1338 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1339 is
kono
parents:
diff changeset
1340 begin
kono
parents:
diff changeset
1341 Raise_Program_Error_Msg (File, Line, Rmsg_19'Address);
kono
parents:
diff changeset
1342 end Rcheck_PE_Bad_Predicated_Generic_Type;
kono
parents:
diff changeset
1343
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1344 procedure Rcheck_PE_Build_In_Place_Mismatch
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1345 (File : System.Address; Line : Integer)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1346 is
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1347 begin
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1348 Raise_Program_Error_Msg (File, Line, Rmsg_37'Address);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1349 end Rcheck_PE_Build_In_Place_Mismatch;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1350
111
kono
parents:
diff changeset
1351 procedure Rcheck_PE_Current_Task_In_Entry_Body
kono
parents:
diff changeset
1352 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1353 is
kono
parents:
diff changeset
1354 begin
kono
parents:
diff changeset
1355 Raise_Program_Error_Msg (File, Line, Rmsg_20'Address);
kono
parents:
diff changeset
1356 end Rcheck_PE_Current_Task_In_Entry_Body;
kono
parents:
diff changeset
1357
kono
parents:
diff changeset
1358 procedure Rcheck_PE_Duplicated_Entry_Address
kono
parents:
diff changeset
1359 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1360 is
kono
parents:
diff changeset
1361 begin
kono
parents:
diff changeset
1362 Raise_Program_Error_Msg (File, Line, Rmsg_21'Address);
kono
parents:
diff changeset
1363 end Rcheck_PE_Duplicated_Entry_Address;
kono
parents:
diff changeset
1364
kono
parents:
diff changeset
1365 procedure Rcheck_PE_Explicit_Raise
kono
parents:
diff changeset
1366 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1367 is
kono
parents:
diff changeset
1368 begin
kono
parents:
diff changeset
1369 Raise_Program_Error_Msg (File, Line, Rmsg_22'Address);
kono
parents:
diff changeset
1370 end Rcheck_PE_Explicit_Raise;
kono
parents:
diff changeset
1371
kono
parents:
diff changeset
1372 procedure Rcheck_PE_Implicit_Return
kono
parents:
diff changeset
1373 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1374 is
kono
parents:
diff changeset
1375 begin
kono
parents:
diff changeset
1376 Raise_Program_Error_Msg (File, Line, Rmsg_24'Address);
kono
parents:
diff changeset
1377 end Rcheck_PE_Implicit_Return;
kono
parents:
diff changeset
1378
kono
parents:
diff changeset
1379 procedure Rcheck_PE_Misaligned_Address_Value
kono
parents:
diff changeset
1380 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1381 is
kono
parents:
diff changeset
1382 begin
kono
parents:
diff changeset
1383 Raise_Program_Error_Msg (File, Line, Rmsg_25'Address);
kono
parents:
diff changeset
1384 end Rcheck_PE_Misaligned_Address_Value;
kono
parents:
diff changeset
1385
kono
parents:
diff changeset
1386 procedure Rcheck_PE_Missing_Return
kono
parents:
diff changeset
1387 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1388 is
kono
parents:
diff changeset
1389 begin
kono
parents:
diff changeset
1390 Raise_Program_Error_Msg (File, Line, Rmsg_26'Address);
kono
parents:
diff changeset
1391 end Rcheck_PE_Missing_Return;
kono
parents:
diff changeset
1392
kono
parents:
diff changeset
1393 procedure Rcheck_PE_Non_Transportable_Actual
kono
parents:
diff changeset
1394 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1395 is
kono
parents:
diff changeset
1396 begin
kono
parents:
diff changeset
1397 Raise_Program_Error_Msg (File, Line, Rmsg_31'Address);
kono
parents:
diff changeset
1398 end Rcheck_PE_Non_Transportable_Actual;
kono
parents:
diff changeset
1399
kono
parents:
diff changeset
1400 procedure Rcheck_PE_Overlaid_Controlled_Object
kono
parents:
diff changeset
1401 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1402 is
kono
parents:
diff changeset
1403 begin
kono
parents:
diff changeset
1404 Raise_Program_Error_Msg (File, Line, Rmsg_27'Address);
kono
parents:
diff changeset
1405 end Rcheck_PE_Overlaid_Controlled_Object;
kono
parents:
diff changeset
1406
kono
parents:
diff changeset
1407 procedure Rcheck_PE_Potentially_Blocking_Operation
kono
parents:
diff changeset
1408 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1409 is
kono
parents:
diff changeset
1410 begin
kono
parents:
diff changeset
1411 Raise_Program_Error_Msg (File, Line, Rmsg_28'Address);
kono
parents:
diff changeset
1412 end Rcheck_PE_Potentially_Blocking_Operation;
kono
parents:
diff changeset
1413
kono
parents:
diff changeset
1414 procedure Rcheck_PE_Stream_Operation_Not_Allowed
kono
parents:
diff changeset
1415 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1416 is
kono
parents:
diff changeset
1417 begin
kono
parents:
diff changeset
1418 Raise_Program_Error_Msg (File, Line, Rmsg_36'Address);
kono
parents:
diff changeset
1419 end Rcheck_PE_Stream_Operation_Not_Allowed;
kono
parents:
diff changeset
1420
kono
parents:
diff changeset
1421 procedure Rcheck_PE_Stubbed_Subprogram_Called
kono
parents:
diff changeset
1422 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1423 is
kono
parents:
diff changeset
1424 begin
kono
parents:
diff changeset
1425 Raise_Program_Error_Msg (File, Line, Rmsg_29'Address);
kono
parents:
diff changeset
1426 end Rcheck_PE_Stubbed_Subprogram_Called;
kono
parents:
diff changeset
1427
kono
parents:
diff changeset
1428 procedure Rcheck_PE_Unchecked_Union_Restriction
kono
parents:
diff changeset
1429 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1430 is
kono
parents:
diff changeset
1431 begin
kono
parents:
diff changeset
1432 Raise_Program_Error_Msg (File, Line, Rmsg_30'Address);
kono
parents:
diff changeset
1433 end Rcheck_PE_Unchecked_Union_Restriction;
kono
parents:
diff changeset
1434
kono
parents:
diff changeset
1435 procedure Rcheck_SE_Empty_Storage_Pool
kono
parents:
diff changeset
1436 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1437 is
kono
parents:
diff changeset
1438 begin
kono
parents:
diff changeset
1439 Raise_Storage_Error_Msg (File, Line, Rmsg_32'Address);
kono
parents:
diff changeset
1440 end Rcheck_SE_Empty_Storage_Pool;
kono
parents:
diff changeset
1441
kono
parents:
diff changeset
1442 procedure Rcheck_SE_Explicit_Raise
kono
parents:
diff changeset
1443 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1444 is
kono
parents:
diff changeset
1445 begin
kono
parents:
diff changeset
1446 Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address);
kono
parents:
diff changeset
1447 end Rcheck_SE_Explicit_Raise;
kono
parents:
diff changeset
1448
kono
parents:
diff changeset
1449 procedure Rcheck_SE_Infinite_Recursion
kono
parents:
diff changeset
1450 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1451 is
kono
parents:
diff changeset
1452 begin
kono
parents:
diff changeset
1453 Raise_Storage_Error_Msg (File, Line, Rmsg_34'Address);
kono
parents:
diff changeset
1454 end Rcheck_SE_Infinite_Recursion;
kono
parents:
diff changeset
1455
kono
parents:
diff changeset
1456 procedure Rcheck_SE_Object_Too_Large
kono
parents:
diff changeset
1457 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1458 is
kono
parents:
diff changeset
1459 begin
kono
parents:
diff changeset
1460 Raise_Storage_Error_Msg (File, Line, Rmsg_35'Address);
kono
parents:
diff changeset
1461 end Rcheck_SE_Object_Too_Large;
kono
parents:
diff changeset
1462
kono
parents:
diff changeset
1463 procedure Rcheck_CE_Access_Check_Ext
kono
parents:
diff changeset
1464 (File : System.Address; Line, Column : Integer)
kono
parents:
diff changeset
1465 is
kono
parents:
diff changeset
1466 begin
kono
parents:
diff changeset
1467 Raise_Constraint_Error_Msg (File, Line, Column, Rmsg_00'Address);
kono
parents:
diff changeset
1468 end Rcheck_CE_Access_Check_Ext;
kono
parents:
diff changeset
1469
kono
parents:
diff changeset
1470 procedure Rcheck_CE_Index_Check_Ext
kono
parents:
diff changeset
1471 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1472 is
kono
parents:
diff changeset
1473 Msg : constant String :=
kono
parents:
diff changeset
1474 Rmsg_05 (Rmsg_05'First .. Rmsg_05'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1475 & "index " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1476 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1477 begin
kono
parents:
diff changeset
1478 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1479 end Rcheck_CE_Index_Check_Ext;
kono
parents:
diff changeset
1480
kono
parents:
diff changeset
1481 procedure Rcheck_CE_Invalid_Data_Ext
kono
parents:
diff changeset
1482 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1483 is
kono
parents:
diff changeset
1484 Msg : constant String :=
kono
parents:
diff changeset
1485 Rmsg_06 (Rmsg_06'First .. Rmsg_06'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1486 & "value " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1487 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1488 begin
kono
parents:
diff changeset
1489 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1490 end Rcheck_CE_Invalid_Data_Ext;
kono
parents:
diff changeset
1491
kono
parents:
diff changeset
1492 procedure Rcheck_CE_Range_Check_Ext
kono
parents:
diff changeset
1493 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1494 is
kono
parents:
diff changeset
1495 Msg : constant String :=
kono
parents:
diff changeset
1496 Rmsg_12 (Rmsg_12'First .. Rmsg_12'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1497 & "value " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1498 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1499 begin
kono
parents:
diff changeset
1500 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1501 end Rcheck_CE_Range_Check_Ext;
kono
parents:
diff changeset
1502
kono
parents:
diff changeset
1503 procedure Rcheck_PE_Finalize_Raised_Exception
kono
parents:
diff changeset
1504 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1505 is
kono
parents:
diff changeset
1506 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1507
kono
parents:
diff changeset
1508 begin
kono
parents:
diff changeset
1509 -- This is "finalize/adjust raised exception". This subprogram is always
kono
parents:
diff changeset
1510 -- called with abort deferred, unlike all other Rcheck_* subprograms, it
kono
parents:
diff changeset
1511 -- needs to call Raise_Exception_No_Defer.
kono
parents:
diff changeset
1512
kono
parents:
diff changeset
1513 -- This is consistent with Raise_From_Controlled_Operation
kono
parents:
diff changeset
1514
kono
parents:
diff changeset
1515 Exception_Data.Set_Exception_C_Msg
kono
parents:
diff changeset
1516 (X, Program_Error_Def'Access, File, Line, 0, Rmsg_23'Address);
kono
parents:
diff changeset
1517 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
1518 end Rcheck_PE_Finalize_Raised_Exception;
kono
parents:
diff changeset
1519
kono
parents:
diff changeset
1520 -------------
kono
parents:
diff changeset
1521 -- Reraise --
kono
parents:
diff changeset
1522 -------------
kono
parents:
diff changeset
1523
kono
parents:
diff changeset
1524 procedure Reraise is
kono
parents:
diff changeset
1525 Excep : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1526 Saved_MO : constant System.Address := Excep.Machine_Occurrence;
kono
parents:
diff changeset
1527
kono
parents:
diff changeset
1528 begin
kono
parents:
diff changeset
1529 if not ZCX_By_Default then
kono
parents:
diff changeset
1530 Abort_Defer.all;
kono
parents:
diff changeset
1531 end if;
kono
parents:
diff changeset
1532
kono
parents:
diff changeset
1533 Save_Occurrence (Excep.all, Get_Current_Excep.all.all);
kono
parents:
diff changeset
1534 Excep.Machine_Occurrence := Saved_MO;
kono
parents:
diff changeset
1535 Complete_And_Propagate_Occurrence (Excep);
kono
parents:
diff changeset
1536 end Reraise;
kono
parents:
diff changeset
1537
kono
parents:
diff changeset
1538 --------------------------------------
kono
parents:
diff changeset
1539 -- Reraise_Library_Exception_If_Any --
kono
parents:
diff changeset
1540 --------------------------------------
kono
parents:
diff changeset
1541
kono
parents:
diff changeset
1542 procedure Reraise_Library_Exception_If_Any is
kono
parents:
diff changeset
1543 LE : Exception_Occurrence;
kono
parents:
diff changeset
1544
kono
parents:
diff changeset
1545 begin
kono
parents:
diff changeset
1546 if Library_Exception_Set then
kono
parents:
diff changeset
1547 LE := Library_Exception;
kono
parents:
diff changeset
1548
kono
parents:
diff changeset
1549 if LE.Id = Null_Id then
kono
parents:
diff changeset
1550 Raise_Exception_No_Defer
kono
parents:
diff changeset
1551 (E => Program_Error'Identity,
kono
parents:
diff changeset
1552 Message => "finalize/adjust raised exception");
kono
parents:
diff changeset
1553 else
kono
parents:
diff changeset
1554 Raise_From_Controlled_Operation (LE);
kono
parents:
diff changeset
1555 end if;
kono
parents:
diff changeset
1556 end if;
kono
parents:
diff changeset
1557 end Reraise_Library_Exception_If_Any;
kono
parents:
diff changeset
1558
kono
parents:
diff changeset
1559 ------------------------
kono
parents:
diff changeset
1560 -- Reraise_Occurrence --
kono
parents:
diff changeset
1561 ------------------------
kono
parents:
diff changeset
1562
kono
parents:
diff changeset
1563 procedure Reraise_Occurrence (X : Exception_Occurrence) is
kono
parents:
diff changeset
1564 begin
kono
parents:
diff changeset
1565 if X.Id = null then
kono
parents:
diff changeset
1566 return;
kono
parents:
diff changeset
1567 else
kono
parents:
diff changeset
1568 Reraise_Occurrence_Always (X);
kono
parents:
diff changeset
1569 end if;
kono
parents:
diff changeset
1570 end Reraise_Occurrence;
kono
parents:
diff changeset
1571
kono
parents:
diff changeset
1572 -------------------------------
kono
parents:
diff changeset
1573 -- Reraise_Occurrence_Always --
kono
parents:
diff changeset
1574 -------------------------------
kono
parents:
diff changeset
1575
kono
parents:
diff changeset
1576 procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
kono
parents:
diff changeset
1577 begin
kono
parents:
diff changeset
1578 if not ZCX_By_Default then
kono
parents:
diff changeset
1579 Abort_Defer.all;
kono
parents:
diff changeset
1580 end if;
kono
parents:
diff changeset
1581
kono
parents:
diff changeset
1582 Reraise_Occurrence_No_Defer (X);
kono
parents:
diff changeset
1583 end Reraise_Occurrence_Always;
kono
parents:
diff changeset
1584
kono
parents:
diff changeset
1585 ---------------------------------
kono
parents:
diff changeset
1586 -- Reraise_Occurrence_No_Defer --
kono
parents:
diff changeset
1587 ---------------------------------
kono
parents:
diff changeset
1588
kono
parents:
diff changeset
1589 procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
kono
parents:
diff changeset
1590 begin
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1591 -- If we have a Machine_Occurrence at hand already, e.g. when we are
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1592 -- reraising a foreign exception, just repropagate. Otherwise, e.g.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1593 -- when reraising a GNAT exception or an occurrence read back from a
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1594 -- stream, set up a new occurrence with its own Machine block first.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1595
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1596 if X.Machine_Occurrence /= System.Null_Address then
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1597 Exception_Propagation.Propagate_Exception (X);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1598 else
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1599 declare
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1600 Excep : constant EOA
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1601 := Exception_Propagation.Allocate_Occurrence;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1602 Saved_MO : constant System.Address := Excep.Machine_Occurrence;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1603 begin
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1604 Save_Occurrence (Excep.all, X);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1605 Excep.Machine_Occurrence := Saved_MO;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1606 Complete_And_Propagate_Occurrence (Excep);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1607 end;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1608 end if;
111
kono
parents:
diff changeset
1609 end Reraise_Occurrence_No_Defer;
kono
parents:
diff changeset
1610
kono
parents:
diff changeset
1611 ---------------------
kono
parents:
diff changeset
1612 -- Save_Occurrence --
kono
parents:
diff changeset
1613 ---------------------
kono
parents:
diff changeset
1614
kono
parents:
diff changeset
1615 procedure Save_Occurrence
kono
parents:
diff changeset
1616 (Target : out Exception_Occurrence;
kono
parents:
diff changeset
1617 Source : Exception_Occurrence)
kono
parents:
diff changeset
1618 is
kono
parents:
diff changeset
1619 begin
kono
parents:
diff changeset
1620 -- As the machine occurrence might be a data that must be finalized
kono
parents:
diff changeset
1621 -- (outside any Ada mechanism), do not copy it
kono
parents:
diff changeset
1622
kono
parents:
diff changeset
1623 Target.Id := Source.Id;
kono
parents:
diff changeset
1624 Target.Machine_Occurrence := System.Null_Address;
kono
parents:
diff changeset
1625 Target.Msg_Length := Source.Msg_Length;
kono
parents:
diff changeset
1626 Target.Num_Tracebacks := Source.Num_Tracebacks;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1627 Target.Exception_Raised := Source.Exception_Raised;
111
kono
parents:
diff changeset
1628 Target.Pid := Source.Pid;
kono
parents:
diff changeset
1629
kono
parents:
diff changeset
1630 Target.Msg (1 .. Target.Msg_Length) :=
kono
parents:
diff changeset
1631 Source.Msg (1 .. Target.Msg_Length);
kono
parents:
diff changeset
1632
kono
parents:
diff changeset
1633 Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
kono
parents:
diff changeset
1634 Source.Tracebacks (1 .. Target.Num_Tracebacks);
kono
parents:
diff changeset
1635 end Save_Occurrence;
kono
parents:
diff changeset
1636
kono
parents:
diff changeset
1637 function Save_Occurrence (Source : Exception_Occurrence) return EOA is
kono
parents:
diff changeset
1638 Target : constant EOA := new Exception_Occurrence;
kono
parents:
diff changeset
1639 begin
kono
parents:
diff changeset
1640 Save_Occurrence (Target.all, Source);
kono
parents:
diff changeset
1641 return Target;
kono
parents:
diff changeset
1642 end Save_Occurrence;
kono
parents:
diff changeset
1643
kono
parents:
diff changeset
1644 -------------------
kono
parents:
diff changeset
1645 -- String_To_EId --
kono
parents:
diff changeset
1646 -------------------
kono
parents:
diff changeset
1647
kono
parents:
diff changeset
1648 function String_To_EId (S : String) return Exception_Id
kono
parents:
diff changeset
1649 renames Stream_Attributes.String_To_EId;
kono
parents:
diff changeset
1650
kono
parents:
diff changeset
1651 ------------------
kono
parents:
diff changeset
1652 -- String_To_EO --
kono
parents:
diff changeset
1653 ------------------
kono
parents:
diff changeset
1654
kono
parents:
diff changeset
1655 function String_To_EO (S : String) return Exception_Occurrence
kono
parents:
diff changeset
1656 renames Stream_Attributes.String_To_EO;
kono
parents:
diff changeset
1657
kono
parents:
diff changeset
1658 ---------------
kono
parents:
diff changeset
1659 -- To_Stderr --
kono
parents:
diff changeset
1660 ---------------
kono
parents:
diff changeset
1661
kono
parents:
diff changeset
1662 procedure To_Stderr (C : Character) is
kono
parents:
diff changeset
1663 procedure Put_Char_Stderr (C : Character);
kono
parents:
diff changeset
1664 pragma Import (C, Put_Char_Stderr, "put_char_stderr");
kono
parents:
diff changeset
1665 begin
kono
parents:
diff changeset
1666 Put_Char_Stderr (C);
kono
parents:
diff changeset
1667 end To_Stderr;
kono
parents:
diff changeset
1668
kono
parents:
diff changeset
1669 procedure To_Stderr (S : String) is
kono
parents:
diff changeset
1670 begin
kono
parents:
diff changeset
1671 for J in S'Range loop
kono
parents:
diff changeset
1672 if S (J) /= ASCII.CR then
kono
parents:
diff changeset
1673 To_Stderr (S (J));
kono
parents:
diff changeset
1674 end if;
kono
parents:
diff changeset
1675 end loop;
kono
parents:
diff changeset
1676 end To_Stderr;
kono
parents:
diff changeset
1677
kono
parents:
diff changeset
1678 -------------------------
kono
parents:
diff changeset
1679 -- Transfer_Occurrence --
kono
parents:
diff changeset
1680 -------------------------
kono
parents:
diff changeset
1681
kono
parents:
diff changeset
1682 procedure Transfer_Occurrence
kono
parents:
diff changeset
1683 (Target : Exception_Occurrence_Access;
kono
parents:
diff changeset
1684 Source : Exception_Occurrence)
kono
parents:
diff changeset
1685 is
kono
parents:
diff changeset
1686 begin
kono
parents:
diff changeset
1687 Save_Occurrence (Target.all, Source);
kono
parents:
diff changeset
1688 end Transfer_Occurrence;
kono
parents:
diff changeset
1689
kono
parents:
diff changeset
1690 ------------------------
kono
parents:
diff changeset
1691 -- Triggered_By_Abort --
kono
parents:
diff changeset
1692 ------------------------
kono
parents:
diff changeset
1693
kono
parents:
diff changeset
1694 function Triggered_By_Abort return Boolean is
kono
parents:
diff changeset
1695 Ex : constant Exception_Occurrence_Access := Get_Current_Excep.all;
kono
parents:
diff changeset
1696 begin
kono
parents:
diff changeset
1697 return Ex /= null
kono
parents:
diff changeset
1698 and then Exception_Identity (Ex.all) = Standard'Abort_Signal'Identity;
kono
parents:
diff changeset
1699 end Triggered_By_Abort;
kono
parents:
diff changeset
1700
kono
parents:
diff changeset
1701 -------------------------
kono
parents:
diff changeset
1702 -- Wide_Exception_Name --
kono
parents:
diff changeset
1703 -------------------------
kono
parents:
diff changeset
1704
kono
parents:
diff changeset
1705 WC_Encoding : Character;
kono
parents:
diff changeset
1706 pragma Import (C, WC_Encoding, "__gl_wc_encoding");
kono
parents:
diff changeset
1707 -- Encoding method for source, as exported by binder
kono
parents:
diff changeset
1708
kono
parents:
diff changeset
1709 function Wide_Exception_Name
kono
parents:
diff changeset
1710 (Id : Exception_Id) return Wide_String
kono
parents:
diff changeset
1711 is
kono
parents:
diff changeset
1712 S : constant String := Exception_Name (Id);
kono
parents:
diff changeset
1713 W : Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1714 L : Natural;
kono
parents:
diff changeset
1715 begin
kono
parents:
diff changeset
1716 String_To_Wide_String
kono
parents:
diff changeset
1717 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1718 return W (1 .. L);
kono
parents:
diff changeset
1719 end Wide_Exception_Name;
kono
parents:
diff changeset
1720
kono
parents:
diff changeset
1721 function Wide_Exception_Name
kono
parents:
diff changeset
1722 (X : Exception_Occurrence) return Wide_String
kono
parents:
diff changeset
1723 is
kono
parents:
diff changeset
1724 S : constant String := Exception_Name (X);
kono
parents:
diff changeset
1725 W : Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1726 L : Natural;
kono
parents:
diff changeset
1727 begin
kono
parents:
diff changeset
1728 String_To_Wide_String
kono
parents:
diff changeset
1729 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1730 return W (1 .. L);
kono
parents:
diff changeset
1731 end Wide_Exception_Name;
kono
parents:
diff changeset
1732
kono
parents:
diff changeset
1733 ----------------------------
kono
parents:
diff changeset
1734 -- Wide_Wide_Exception_Name --
kono
parents:
diff changeset
1735 -----------------------------
kono
parents:
diff changeset
1736
kono
parents:
diff changeset
1737 function Wide_Wide_Exception_Name
kono
parents:
diff changeset
1738 (Id : Exception_Id) return Wide_Wide_String
kono
parents:
diff changeset
1739 is
kono
parents:
diff changeset
1740 S : constant String := Exception_Name (Id);
kono
parents:
diff changeset
1741 W : Wide_Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1742 L : Natural;
kono
parents:
diff changeset
1743 begin
kono
parents:
diff changeset
1744 String_To_Wide_Wide_String
kono
parents:
diff changeset
1745 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1746 return W (1 .. L);
kono
parents:
diff changeset
1747 end Wide_Wide_Exception_Name;
kono
parents:
diff changeset
1748
kono
parents:
diff changeset
1749 function Wide_Wide_Exception_Name
kono
parents:
diff changeset
1750 (X : Exception_Occurrence) return Wide_Wide_String
kono
parents:
diff changeset
1751 is
kono
parents:
diff changeset
1752 S : constant String := Exception_Name (X);
kono
parents:
diff changeset
1753 W : Wide_Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1754 L : Natural;
kono
parents:
diff changeset
1755 begin
kono
parents:
diff changeset
1756 String_To_Wide_Wide_String
kono
parents:
diff changeset
1757 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1758 return W (1 .. L);
kono
parents:
diff changeset
1759 end Wide_Wide_Exception_Name;
kono
parents:
diff changeset
1760
kono
parents:
diff changeset
1761 --------------------------
kono
parents:
diff changeset
1762 -- Code_Address_For_ZZZ --
kono
parents:
diff changeset
1763 --------------------------
kono
parents:
diff changeset
1764
kono
parents:
diff changeset
1765 -- This function gives us the end of the PC range for addresses
kono
parents:
diff changeset
1766 -- within the exception unit itself. We hope that gigi/gcc keeps all the
kono
parents:
diff changeset
1767 -- procedures in their original order.
kono
parents:
diff changeset
1768
kono
parents:
diff changeset
1769 function Code_Address_For_ZZZ return System.Address is
kono
parents:
diff changeset
1770 begin
kono
parents:
diff changeset
1771 <<Start_Of_ZZZ>>
kono
parents:
diff changeset
1772 return Start_Of_ZZZ'Address;
kono
parents:
diff changeset
1773 end Code_Address_For_ZZZ;
kono
parents:
diff changeset
1774
kono
parents:
diff changeset
1775 end Ada.Exceptions;