annotate gcc/ada/libgnat/a-except.adb @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
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 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
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
kono
parents:
diff changeset
231 procedure Propagate_Exception (Excep : EOA);
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);
kono
parents:
diff changeset
435 procedure Rcheck_PE_Current_Task_In_Entry_Body
kono
parents:
diff changeset
436 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
437 procedure Rcheck_PE_Duplicated_Entry_Address
kono
parents:
diff changeset
438 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
439 procedure Rcheck_PE_Explicit_Raise
kono
parents:
diff changeset
440 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
441 procedure Rcheck_PE_Implicit_Return
kono
parents:
diff changeset
442 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
443 procedure Rcheck_PE_Misaligned_Address_Value
kono
parents:
diff changeset
444 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
445 procedure Rcheck_PE_Missing_Return
kono
parents:
diff changeset
446 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
447 procedure Rcheck_PE_Non_Transportable_Actual
kono
parents:
diff changeset
448 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
449 procedure Rcheck_PE_Overlaid_Controlled_Object
kono
parents:
diff changeset
450 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
451 procedure Rcheck_PE_Potentially_Blocking_Operation
kono
parents:
diff changeset
452 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
453 procedure Rcheck_PE_Stubbed_Subprogram_Called
kono
parents:
diff changeset
454 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
455 procedure Rcheck_PE_Unchecked_Union_Restriction
kono
parents:
diff changeset
456 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
457 procedure Rcheck_SE_Empty_Storage_Pool
kono
parents:
diff changeset
458 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
459 procedure Rcheck_SE_Explicit_Raise
kono
parents:
diff changeset
460 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
461 procedure Rcheck_SE_Infinite_Recursion
kono
parents:
diff changeset
462 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
463 procedure Rcheck_SE_Object_Too_Large
kono
parents:
diff changeset
464 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
465 procedure Rcheck_PE_Stream_Operation_Not_Allowed
kono
parents:
diff changeset
466 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
467 procedure Rcheck_CE_Access_Check_Ext
kono
parents:
diff changeset
468 (File : System.Address; Line, Column : Integer);
kono
parents:
diff changeset
469 procedure Rcheck_CE_Index_Check_Ext
kono
parents:
diff changeset
470 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
471 procedure Rcheck_CE_Invalid_Data_Ext
kono
parents:
diff changeset
472 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
473 procedure Rcheck_CE_Range_Check_Ext
kono
parents:
diff changeset
474 (File : System.Address; Line, Column, Index, First, Last : Integer);
kono
parents:
diff changeset
475
kono
parents:
diff changeset
476 procedure Rcheck_PE_Finalize_Raised_Exception
kono
parents:
diff changeset
477 (File : System.Address; Line : Integer);
kono
parents:
diff changeset
478 -- This routine is separated out because it has quite different behavior
kono
parents:
diff changeset
479 -- from the others. This is the "finalize/adjust raised exception". This
kono
parents:
diff changeset
480 -- subprogram is always called with abort deferred, unlike all other
kono
parents:
diff changeset
481 -- Rcheck_* subprograms, it needs to call Raise_Exception_No_Defer.
kono
parents:
diff changeset
482
kono
parents:
diff changeset
483 pragma Export (C, Rcheck_CE_Access_Check,
kono
parents:
diff changeset
484 "__gnat_rcheck_CE_Access_Check");
kono
parents:
diff changeset
485 pragma Export (C, Rcheck_CE_Null_Access_Parameter,
kono
parents:
diff changeset
486 "__gnat_rcheck_CE_Null_Access_Parameter");
kono
parents:
diff changeset
487 pragma Export (C, Rcheck_CE_Discriminant_Check,
kono
parents:
diff changeset
488 "__gnat_rcheck_CE_Discriminant_Check");
kono
parents:
diff changeset
489 pragma Export (C, Rcheck_CE_Divide_By_Zero,
kono
parents:
diff changeset
490 "__gnat_rcheck_CE_Divide_By_Zero");
kono
parents:
diff changeset
491 pragma Export (C, Rcheck_CE_Explicit_Raise,
kono
parents:
diff changeset
492 "__gnat_rcheck_CE_Explicit_Raise");
kono
parents:
diff changeset
493 pragma Export (C, Rcheck_CE_Index_Check,
kono
parents:
diff changeset
494 "__gnat_rcheck_CE_Index_Check");
kono
parents:
diff changeset
495 pragma Export (C, Rcheck_CE_Invalid_Data,
kono
parents:
diff changeset
496 "__gnat_rcheck_CE_Invalid_Data");
kono
parents:
diff changeset
497 pragma Export (C, Rcheck_CE_Length_Check,
kono
parents:
diff changeset
498 "__gnat_rcheck_CE_Length_Check");
kono
parents:
diff changeset
499 pragma Export (C, Rcheck_CE_Null_Exception_Id,
kono
parents:
diff changeset
500 "__gnat_rcheck_CE_Null_Exception_Id");
kono
parents:
diff changeset
501 pragma Export (C, Rcheck_CE_Null_Not_Allowed,
kono
parents:
diff changeset
502 "__gnat_rcheck_CE_Null_Not_Allowed");
kono
parents:
diff changeset
503 pragma Export (C, Rcheck_CE_Overflow_Check,
kono
parents:
diff changeset
504 "__gnat_rcheck_CE_Overflow_Check");
kono
parents:
diff changeset
505 pragma Export (C, Rcheck_CE_Partition_Check,
kono
parents:
diff changeset
506 "__gnat_rcheck_CE_Partition_Check");
kono
parents:
diff changeset
507 pragma Export (C, Rcheck_CE_Range_Check,
kono
parents:
diff changeset
508 "__gnat_rcheck_CE_Range_Check");
kono
parents:
diff changeset
509 pragma Export (C, Rcheck_CE_Tag_Check,
kono
parents:
diff changeset
510 "__gnat_rcheck_CE_Tag_Check");
kono
parents:
diff changeset
511 pragma Export (C, Rcheck_PE_Access_Before_Elaboration,
kono
parents:
diff changeset
512 "__gnat_rcheck_PE_Access_Before_Elaboration");
kono
parents:
diff changeset
513 pragma Export (C, Rcheck_PE_Accessibility_Check,
kono
parents:
diff changeset
514 "__gnat_rcheck_PE_Accessibility_Check");
kono
parents:
diff changeset
515 pragma Export (C, Rcheck_PE_Address_Of_Intrinsic,
kono
parents:
diff changeset
516 "__gnat_rcheck_PE_Address_Of_Intrinsic");
kono
parents:
diff changeset
517 pragma Export (C, Rcheck_PE_Aliased_Parameters,
kono
parents:
diff changeset
518 "__gnat_rcheck_PE_Aliased_Parameters");
kono
parents:
diff changeset
519 pragma Export (C, Rcheck_PE_All_Guards_Closed,
kono
parents:
diff changeset
520 "__gnat_rcheck_PE_All_Guards_Closed");
kono
parents:
diff changeset
521 pragma Export (C, Rcheck_PE_Bad_Predicated_Generic_Type,
kono
parents:
diff changeset
522 "__gnat_rcheck_PE_Bad_Predicated_Generic_Type");
kono
parents:
diff changeset
523 pragma Export (C, Rcheck_PE_Current_Task_In_Entry_Body,
kono
parents:
diff changeset
524 "__gnat_rcheck_PE_Current_Task_In_Entry_Body");
kono
parents:
diff changeset
525 pragma Export (C, Rcheck_PE_Duplicated_Entry_Address,
kono
parents:
diff changeset
526 "__gnat_rcheck_PE_Duplicated_Entry_Address");
kono
parents:
diff changeset
527 pragma Export (C, Rcheck_PE_Explicit_Raise,
kono
parents:
diff changeset
528 "__gnat_rcheck_PE_Explicit_Raise");
kono
parents:
diff changeset
529 pragma Export (C, Rcheck_PE_Finalize_Raised_Exception,
kono
parents:
diff changeset
530 "__gnat_rcheck_PE_Finalize_Raised_Exception");
kono
parents:
diff changeset
531 pragma Export (C, Rcheck_PE_Implicit_Return,
kono
parents:
diff changeset
532 "__gnat_rcheck_PE_Implicit_Return");
kono
parents:
diff changeset
533 pragma Export (C, Rcheck_PE_Misaligned_Address_Value,
kono
parents:
diff changeset
534 "__gnat_rcheck_PE_Misaligned_Address_Value");
kono
parents:
diff changeset
535 pragma Export (C, Rcheck_PE_Missing_Return,
kono
parents:
diff changeset
536 "__gnat_rcheck_PE_Missing_Return");
kono
parents:
diff changeset
537 pragma Export (C, Rcheck_PE_Non_Transportable_Actual,
kono
parents:
diff changeset
538 "__gnat_rcheck_PE_Non_Transportable_Actual");
kono
parents:
diff changeset
539 pragma Export (C, Rcheck_PE_Overlaid_Controlled_Object,
kono
parents:
diff changeset
540 "__gnat_rcheck_PE_Overlaid_Controlled_Object");
kono
parents:
diff changeset
541 pragma Export (C, Rcheck_PE_Potentially_Blocking_Operation,
kono
parents:
diff changeset
542 "__gnat_rcheck_PE_Potentially_Blocking_Operation");
kono
parents:
diff changeset
543 pragma Export (C, Rcheck_PE_Stream_Operation_Not_Allowed,
kono
parents:
diff changeset
544 "__gnat_rcheck_PE_Stream_Operation_Not_Allowed");
kono
parents:
diff changeset
545 pragma Export (C, Rcheck_PE_Stubbed_Subprogram_Called,
kono
parents:
diff changeset
546 "__gnat_rcheck_PE_Stubbed_Subprogram_Called");
kono
parents:
diff changeset
547 pragma Export (C, Rcheck_PE_Unchecked_Union_Restriction,
kono
parents:
diff changeset
548 "__gnat_rcheck_PE_Unchecked_Union_Restriction");
kono
parents:
diff changeset
549 pragma Export (C, Rcheck_SE_Empty_Storage_Pool,
kono
parents:
diff changeset
550 "__gnat_rcheck_SE_Empty_Storage_Pool");
kono
parents:
diff changeset
551 pragma Export (C, Rcheck_SE_Explicit_Raise,
kono
parents:
diff changeset
552 "__gnat_rcheck_SE_Explicit_Raise");
kono
parents:
diff changeset
553 pragma Export (C, Rcheck_SE_Infinite_Recursion,
kono
parents:
diff changeset
554 "__gnat_rcheck_SE_Infinite_Recursion");
kono
parents:
diff changeset
555 pragma Export (C, Rcheck_SE_Object_Too_Large,
kono
parents:
diff changeset
556 "__gnat_rcheck_SE_Object_Too_Large");
kono
parents:
diff changeset
557
kono
parents:
diff changeset
558 pragma Export (C, Rcheck_CE_Access_Check_Ext,
kono
parents:
diff changeset
559 "__gnat_rcheck_CE_Access_Check_ext");
kono
parents:
diff changeset
560 pragma Export (C, Rcheck_CE_Index_Check_Ext,
kono
parents:
diff changeset
561 "__gnat_rcheck_CE_Index_Check_ext");
kono
parents:
diff changeset
562 pragma Export (C, Rcheck_CE_Invalid_Data_Ext,
kono
parents:
diff changeset
563 "__gnat_rcheck_CE_Invalid_Data_ext");
kono
parents:
diff changeset
564 pragma Export (C, Rcheck_CE_Range_Check_Ext,
kono
parents:
diff changeset
565 "__gnat_rcheck_CE_Range_Check_ext");
kono
parents:
diff changeset
566
kono
parents:
diff changeset
567 -- None of these procedures ever returns (they raise an exception). By
kono
parents:
diff changeset
568 -- using pragma No_Return, we ensure that any junk code after the call,
kono
parents:
diff changeset
569 -- such as normal return epilogue stuff, can be eliminated).
kono
parents:
diff changeset
570
kono
parents:
diff changeset
571 pragma No_Return (Rcheck_CE_Access_Check);
kono
parents:
diff changeset
572 pragma No_Return (Rcheck_CE_Null_Access_Parameter);
kono
parents:
diff changeset
573 pragma No_Return (Rcheck_CE_Discriminant_Check);
kono
parents:
diff changeset
574 pragma No_Return (Rcheck_CE_Divide_By_Zero);
kono
parents:
diff changeset
575 pragma No_Return (Rcheck_CE_Explicit_Raise);
kono
parents:
diff changeset
576 pragma No_Return (Rcheck_CE_Index_Check);
kono
parents:
diff changeset
577 pragma No_Return (Rcheck_CE_Invalid_Data);
kono
parents:
diff changeset
578 pragma No_Return (Rcheck_CE_Length_Check);
kono
parents:
diff changeset
579 pragma No_Return (Rcheck_CE_Null_Exception_Id);
kono
parents:
diff changeset
580 pragma No_Return (Rcheck_CE_Null_Not_Allowed);
kono
parents:
diff changeset
581 pragma No_Return (Rcheck_CE_Overflow_Check);
kono
parents:
diff changeset
582 pragma No_Return (Rcheck_CE_Partition_Check);
kono
parents:
diff changeset
583 pragma No_Return (Rcheck_CE_Range_Check);
kono
parents:
diff changeset
584 pragma No_Return (Rcheck_CE_Tag_Check);
kono
parents:
diff changeset
585 pragma No_Return (Rcheck_PE_Access_Before_Elaboration);
kono
parents:
diff changeset
586 pragma No_Return (Rcheck_PE_Accessibility_Check);
kono
parents:
diff changeset
587 pragma No_Return (Rcheck_PE_Address_Of_Intrinsic);
kono
parents:
diff changeset
588 pragma No_Return (Rcheck_PE_Aliased_Parameters);
kono
parents:
diff changeset
589 pragma No_Return (Rcheck_PE_All_Guards_Closed);
kono
parents:
diff changeset
590 pragma No_Return (Rcheck_PE_Bad_Predicated_Generic_Type);
kono
parents:
diff changeset
591 pragma No_Return (Rcheck_PE_Current_Task_In_Entry_Body);
kono
parents:
diff changeset
592 pragma No_Return (Rcheck_PE_Duplicated_Entry_Address);
kono
parents:
diff changeset
593 pragma No_Return (Rcheck_PE_Explicit_Raise);
kono
parents:
diff changeset
594 pragma No_Return (Rcheck_PE_Implicit_Return);
kono
parents:
diff changeset
595 pragma No_Return (Rcheck_PE_Misaligned_Address_Value);
kono
parents:
diff changeset
596 pragma No_Return (Rcheck_PE_Missing_Return);
kono
parents:
diff changeset
597 pragma No_Return (Rcheck_PE_Non_Transportable_Actual);
kono
parents:
diff changeset
598 pragma No_Return (Rcheck_PE_Overlaid_Controlled_Object);
kono
parents:
diff changeset
599 pragma No_Return (Rcheck_PE_Potentially_Blocking_Operation);
kono
parents:
diff changeset
600 pragma No_Return (Rcheck_PE_Stream_Operation_Not_Allowed);
kono
parents:
diff changeset
601 pragma No_Return (Rcheck_PE_Stubbed_Subprogram_Called);
kono
parents:
diff changeset
602 pragma No_Return (Rcheck_PE_Unchecked_Union_Restriction);
kono
parents:
diff changeset
603 pragma No_Return (Rcheck_PE_Finalize_Raised_Exception);
kono
parents:
diff changeset
604 pragma No_Return (Rcheck_SE_Empty_Storage_Pool);
kono
parents:
diff changeset
605 pragma No_Return (Rcheck_SE_Explicit_Raise);
kono
parents:
diff changeset
606 pragma No_Return (Rcheck_SE_Infinite_Recursion);
kono
parents:
diff changeset
607 pragma No_Return (Rcheck_SE_Object_Too_Large);
kono
parents:
diff changeset
608
kono
parents:
diff changeset
609 pragma No_Return (Rcheck_CE_Access_Check_Ext);
kono
parents:
diff changeset
610 pragma No_Return (Rcheck_CE_Index_Check_Ext);
kono
parents:
diff changeset
611 pragma No_Return (Rcheck_CE_Invalid_Data_Ext);
kono
parents:
diff changeset
612 pragma No_Return (Rcheck_CE_Range_Check_Ext);
kono
parents:
diff changeset
613
kono
parents:
diff changeset
614 ---------------------------------------------
kono
parents:
diff changeset
615 -- Reason Strings for Run-Time Check Calls --
kono
parents:
diff changeset
616 ---------------------------------------------
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 -- These strings are null-terminated and are used by Rcheck_nn. The
kono
parents:
diff changeset
619 -- strings correspond to the definitions for Types.RT_Exception_Code.
kono
parents:
diff changeset
620
kono
parents:
diff changeset
621 use ASCII;
kono
parents:
diff changeset
622
kono
parents:
diff changeset
623 Rmsg_00 : constant String := "access check failed" & NUL;
kono
parents:
diff changeset
624 Rmsg_01 : constant String := "access parameter is null" & NUL;
kono
parents:
diff changeset
625 Rmsg_02 : constant String := "discriminant check failed" & NUL;
kono
parents:
diff changeset
626 Rmsg_03 : constant String := "divide by zero" & NUL;
kono
parents:
diff changeset
627 Rmsg_04 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
628 Rmsg_05 : constant String := "index check failed" & NUL;
kono
parents:
diff changeset
629 Rmsg_06 : constant String := "invalid data" & NUL;
kono
parents:
diff changeset
630 Rmsg_07 : constant String := "length check failed" & NUL;
kono
parents:
diff changeset
631 Rmsg_08 : constant String := "null Exception_Id" & NUL;
kono
parents:
diff changeset
632 Rmsg_09 : constant String := "null-exclusion check failed" & NUL;
kono
parents:
diff changeset
633 Rmsg_10 : constant String := "overflow check failed" & NUL;
kono
parents:
diff changeset
634 Rmsg_11 : constant String := "partition check failed" & NUL;
kono
parents:
diff changeset
635 Rmsg_12 : constant String := "range check failed" & NUL;
kono
parents:
diff changeset
636 Rmsg_13 : constant String := "tag check failed" & NUL;
kono
parents:
diff changeset
637 Rmsg_14 : constant String := "access before elaboration" & NUL;
kono
parents:
diff changeset
638 Rmsg_15 : constant String := "accessibility check failed" & NUL;
kono
parents:
diff changeset
639 Rmsg_16 : constant String := "attempt to take address of" &
kono
parents:
diff changeset
640 " intrinsic subprogram" & NUL;
kono
parents:
diff changeset
641 Rmsg_17 : constant String := "aliased parameters" & NUL;
kono
parents:
diff changeset
642 Rmsg_18 : constant String := "all guards closed" & NUL;
kono
parents:
diff changeset
643 Rmsg_19 : constant String := "improper use of generic subtype" &
kono
parents:
diff changeset
644 " with predicate" & NUL;
kono
parents:
diff changeset
645 Rmsg_20 : constant String := "Current_Task referenced in entry" &
kono
parents:
diff changeset
646 " body" & NUL;
kono
parents:
diff changeset
647 Rmsg_21 : constant String := "duplicated entry address" & NUL;
kono
parents:
diff changeset
648 Rmsg_22 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
649 Rmsg_23 : constant String := "finalize/adjust raised exception" & NUL;
kono
parents:
diff changeset
650 Rmsg_24 : constant String := "implicit return with No_Return" & NUL;
kono
parents:
diff changeset
651 Rmsg_25 : constant String := "misaligned address value" & NUL;
kono
parents:
diff changeset
652 Rmsg_26 : constant String := "missing return" & NUL;
kono
parents:
diff changeset
653 Rmsg_27 : constant String := "overlaid controlled object" & NUL;
kono
parents:
diff changeset
654 Rmsg_28 : constant String := "potentially blocking operation" & NUL;
kono
parents:
diff changeset
655 Rmsg_29 : constant String := "stubbed subprogram called" & NUL;
kono
parents:
diff changeset
656 Rmsg_30 : constant String := "unchecked union restriction" & NUL;
kono
parents:
diff changeset
657 Rmsg_31 : constant String := "actual/returned class-wide" &
kono
parents:
diff changeset
658 " value not transportable" & NUL;
kono
parents:
diff changeset
659 Rmsg_32 : constant String := "empty storage pool" & NUL;
kono
parents:
diff changeset
660 Rmsg_33 : constant String := "explicit raise" & NUL;
kono
parents:
diff changeset
661 Rmsg_34 : constant String := "infinite recursion" & NUL;
kono
parents:
diff changeset
662 Rmsg_35 : constant String := "object too large" & NUL;
kono
parents:
diff changeset
663 Rmsg_36 : constant String := "stream operation not allowed" & NUL;
kono
parents:
diff changeset
664
kono
parents:
diff changeset
665 -----------------------
kono
parents:
diff changeset
666 -- Polling Interface --
kono
parents:
diff changeset
667 -----------------------
kono
parents:
diff changeset
668
kono
parents:
diff changeset
669 type Unsigned is mod 2 ** 32;
kono
parents:
diff changeset
670
kono
parents:
diff changeset
671 Counter : Unsigned := 0;
kono
parents:
diff changeset
672 pragma Warnings (Off, Counter);
kono
parents:
diff changeset
673 -- This counter is provided for convenience. It can be used in Poll to
kono
parents:
diff changeset
674 -- perform periodic but not systematic operations.
kono
parents:
diff changeset
675
kono
parents:
diff changeset
676 procedure Poll is separate;
kono
parents:
diff changeset
677 -- The actual polling routine is separate, so that it can easily be
kono
parents:
diff changeset
678 -- replaced with a target dependent version.
kono
parents:
diff changeset
679
kono
parents:
diff changeset
680 --------------------------
kono
parents:
diff changeset
681 -- Code_Address_For_AAA --
kono
parents:
diff changeset
682 --------------------------
kono
parents:
diff changeset
683
kono
parents:
diff changeset
684 -- This function gives us the start of the PC range for addresses within
kono
parents:
diff changeset
685 -- the exception unit itself. We hope that gigi/gcc keep all the procedures
kono
parents:
diff changeset
686 -- in their original order.
kono
parents:
diff changeset
687
kono
parents:
diff changeset
688 function Code_Address_For_AAA return System.Address is
kono
parents:
diff changeset
689 begin
kono
parents:
diff changeset
690 -- We are using a label instead of Code_Address_For_AAA'Address because
kono
parents:
diff changeset
691 -- on some platforms the latter does not yield the address we want, but
kono
parents:
diff changeset
692 -- the address of a stub or of a descriptor instead. This is the case at
kono
parents:
diff changeset
693 -- least on PA-HPUX.
kono
parents:
diff changeset
694
kono
parents:
diff changeset
695 <<Start_Of_AAA>>
kono
parents:
diff changeset
696 return Start_Of_AAA'Address;
kono
parents:
diff changeset
697 end Code_Address_For_AAA;
kono
parents:
diff changeset
698
kono
parents:
diff changeset
699 ----------------
kono
parents:
diff changeset
700 -- Call_Chain --
kono
parents:
diff changeset
701 ----------------
kono
parents:
diff changeset
702
kono
parents:
diff changeset
703 procedure Call_Chain (Excep : EOA) is separate;
kono
parents:
diff changeset
704 -- The actual Call_Chain routine is separate, so that it can easily
kono
parents:
diff changeset
705 -- be dummied out when no exception traceback information is needed.
kono
parents:
diff changeset
706
kono
parents:
diff changeset
707 -------------------
kono
parents:
diff changeset
708 -- EId_To_String --
kono
parents:
diff changeset
709 -------------------
kono
parents:
diff changeset
710
kono
parents:
diff changeset
711 function EId_To_String (X : Exception_Id) return String
kono
parents:
diff changeset
712 renames Stream_Attributes.EId_To_String;
kono
parents:
diff changeset
713
kono
parents:
diff changeset
714 ------------------
kono
parents:
diff changeset
715 -- EO_To_String --
kono
parents:
diff changeset
716 ------------------
kono
parents:
diff changeset
717
kono
parents:
diff changeset
718 -- We use the null string to represent the null occurrence, otherwise we
kono
parents:
diff changeset
719 -- output the Untailored_Exception_Information string for the occurrence.
kono
parents:
diff changeset
720
kono
parents:
diff changeset
721 function EO_To_String (X : Exception_Occurrence) return String
kono
parents:
diff changeset
722 renames Stream_Attributes.EO_To_String;
kono
parents:
diff changeset
723
kono
parents:
diff changeset
724 ------------------------
kono
parents:
diff changeset
725 -- Exception_Identity --
kono
parents:
diff changeset
726 ------------------------
kono
parents:
diff changeset
727
kono
parents:
diff changeset
728 function Exception_Identity
kono
parents:
diff changeset
729 (X : Exception_Occurrence) return Exception_Id
kono
parents:
diff changeset
730 is
kono
parents:
diff changeset
731 begin
kono
parents:
diff changeset
732 -- Note that the following test used to be here for the original
kono
parents:
diff changeset
733 -- Ada 95 semantics, but these were modified by AI-241 to require
kono
parents:
diff changeset
734 -- returning Null_Id instead of raising Constraint_Error.
kono
parents:
diff changeset
735
kono
parents:
diff changeset
736 -- if X.Id = Null_Id then
kono
parents:
diff changeset
737 -- raise Constraint_Error;
kono
parents:
diff changeset
738 -- end if;
kono
parents:
diff changeset
739
kono
parents:
diff changeset
740 return X.Id;
kono
parents:
diff changeset
741 end Exception_Identity;
kono
parents:
diff changeset
742
kono
parents:
diff changeset
743 ---------------------------
kono
parents:
diff changeset
744 -- Exception_Information --
kono
parents:
diff changeset
745 ---------------------------
kono
parents:
diff changeset
746
kono
parents:
diff changeset
747 function Exception_Information (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
748 begin
kono
parents:
diff changeset
749 if X.Id = Null_Id then
kono
parents:
diff changeset
750 raise Constraint_Error;
kono
parents:
diff changeset
751 else
kono
parents:
diff changeset
752 return Exception_Data.Exception_Information (X);
kono
parents:
diff changeset
753 end if;
kono
parents:
diff changeset
754 end Exception_Information;
kono
parents:
diff changeset
755
kono
parents:
diff changeset
756 -----------------------
kono
parents:
diff changeset
757 -- Exception_Message --
kono
parents:
diff changeset
758 -----------------------
kono
parents:
diff changeset
759
kono
parents:
diff changeset
760 function Exception_Message (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
761 begin
kono
parents:
diff changeset
762 if X.Id = Null_Id then
kono
parents:
diff changeset
763 raise Constraint_Error;
kono
parents:
diff changeset
764 else
kono
parents:
diff changeset
765 return X.Msg (1 .. X.Msg_Length);
kono
parents:
diff changeset
766 end if;
kono
parents:
diff changeset
767 end Exception_Message;
kono
parents:
diff changeset
768
kono
parents:
diff changeset
769 --------------------
kono
parents:
diff changeset
770 -- Exception_Name --
kono
parents:
diff changeset
771 --------------------
kono
parents:
diff changeset
772
kono
parents:
diff changeset
773 function Exception_Name (Id : Exception_Id) return String is
kono
parents:
diff changeset
774 begin
kono
parents:
diff changeset
775 if Id = null then
kono
parents:
diff changeset
776 raise Constraint_Error;
kono
parents:
diff changeset
777 else
kono
parents:
diff changeset
778 return To_Ptr (Id.Full_Name) (1 .. Id.Name_Length - 1);
kono
parents:
diff changeset
779 end if;
kono
parents:
diff changeset
780 end Exception_Name;
kono
parents:
diff changeset
781
kono
parents:
diff changeset
782 function Exception_Name (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
783 begin
kono
parents:
diff changeset
784 return Exception_Name (X.Id);
kono
parents:
diff changeset
785 end Exception_Name;
kono
parents:
diff changeset
786
kono
parents:
diff changeset
787 ---------------------------
kono
parents:
diff changeset
788 -- Exception_Name_Simple --
kono
parents:
diff changeset
789 ---------------------------
kono
parents:
diff changeset
790
kono
parents:
diff changeset
791 function Exception_Name_Simple (X : Exception_Occurrence) return String is
kono
parents:
diff changeset
792 Name : constant String := Exception_Name (X);
kono
parents:
diff changeset
793 P : Natural;
kono
parents:
diff changeset
794
kono
parents:
diff changeset
795 begin
kono
parents:
diff changeset
796 P := Name'Length;
kono
parents:
diff changeset
797 while P > 1 loop
kono
parents:
diff changeset
798 exit when Name (P - 1) = '.';
kono
parents:
diff changeset
799 P := P - 1;
kono
parents:
diff changeset
800 end loop;
kono
parents:
diff changeset
801
kono
parents:
diff changeset
802 -- Return result making sure lower bound is 1
kono
parents:
diff changeset
803
kono
parents:
diff changeset
804 declare
kono
parents:
diff changeset
805 subtype Rname is String (1 .. Name'Length - P + 1);
kono
parents:
diff changeset
806 begin
kono
parents:
diff changeset
807 return Rname (Name (P .. Name'Length));
kono
parents:
diff changeset
808 end;
kono
parents:
diff changeset
809 end Exception_Name_Simple;
kono
parents:
diff changeset
810
kono
parents:
diff changeset
811 --------------------
kono
parents:
diff changeset
812 -- Exception_Data --
kono
parents:
diff changeset
813 --------------------
kono
parents:
diff changeset
814
kono
parents:
diff changeset
815 package body Exception_Data is separate;
kono
parents:
diff changeset
816 -- This package can be easily dummied out if we do not want the basic
kono
parents:
diff changeset
817 -- support for exception messages (such as in Ada 83).
kono
parents:
diff changeset
818
kono
parents:
diff changeset
819 ---------------------------
kono
parents:
diff changeset
820 -- Exception_Propagation --
kono
parents:
diff changeset
821 ---------------------------
kono
parents:
diff changeset
822
kono
parents:
diff changeset
823 package body Exception_Propagation is separate;
kono
parents:
diff changeset
824 -- Depending on the actual exception mechanism used (front-end or
kono
parents:
diff changeset
825 -- back-end based), the implementation will differ, which is why this
kono
parents:
diff changeset
826 -- package is separated.
kono
parents:
diff changeset
827
kono
parents:
diff changeset
828 ----------------------
kono
parents:
diff changeset
829 -- Exception_Traces --
kono
parents:
diff changeset
830 ----------------------
kono
parents:
diff changeset
831
kono
parents:
diff changeset
832 package body Exception_Traces is separate;
kono
parents:
diff changeset
833 -- Depending on the underlying support for IO the implementation will
kono
parents:
diff changeset
834 -- differ. Moreover we would like to dummy out this package in case we
kono
parents:
diff changeset
835 -- do not want any exception tracing support. This is why this package
kono
parents:
diff changeset
836 -- is separated.
kono
parents:
diff changeset
837
kono
parents:
diff changeset
838 --------------------------------------
kono
parents:
diff changeset
839 -- Get_Exception_Machine_Occurrence --
kono
parents:
diff changeset
840 --------------------------------------
kono
parents:
diff changeset
841
kono
parents:
diff changeset
842 function Get_Exception_Machine_Occurrence
kono
parents:
diff changeset
843 (X : Exception_Occurrence) return System.Address
kono
parents:
diff changeset
844 is
kono
parents:
diff changeset
845 begin
kono
parents:
diff changeset
846 return X.Machine_Occurrence;
kono
parents:
diff changeset
847 end Get_Exception_Machine_Occurrence;
kono
parents:
diff changeset
848
kono
parents:
diff changeset
849 -----------
kono
parents:
diff changeset
850 -- Image --
kono
parents:
diff changeset
851 -----------
kono
parents:
diff changeset
852
kono
parents:
diff changeset
853 function Image (Index : Integer) return String is
kono
parents:
diff changeset
854 Result : constant String := Integer'Image (Index);
kono
parents:
diff changeset
855 begin
kono
parents:
diff changeset
856 if Result (1) = ' ' then
kono
parents:
diff changeset
857 return Result (2 .. Result'Last);
kono
parents:
diff changeset
858 else
kono
parents:
diff changeset
859 return Result;
kono
parents:
diff changeset
860 end if;
kono
parents:
diff changeset
861 end Image;
kono
parents:
diff changeset
862
kono
parents:
diff changeset
863 -----------------------
kono
parents:
diff changeset
864 -- Stream Attributes --
kono
parents:
diff changeset
865 -----------------------
kono
parents:
diff changeset
866
kono
parents:
diff changeset
867 package body Stream_Attributes is separate;
kono
parents:
diff changeset
868 -- This package can be easily dummied out if we do not want the
kono
parents:
diff changeset
869 -- support for streaming Exception_Ids and Exception_Occurrences.
kono
parents:
diff changeset
870
kono
parents:
diff changeset
871 ----------------------------
kono
parents:
diff changeset
872 -- Raise_Constraint_Error --
kono
parents:
diff changeset
873 ----------------------------
kono
parents:
diff changeset
874
kono
parents:
diff changeset
875 procedure Raise_Constraint_Error (File : System.Address; Line : Integer) is
kono
parents:
diff changeset
876 begin
kono
parents:
diff changeset
877 Raise_With_Location_And_Msg (Constraint_Error_Def'Access, File, Line);
kono
parents:
diff changeset
878 end Raise_Constraint_Error;
kono
parents:
diff changeset
879
kono
parents:
diff changeset
880 --------------------------------
kono
parents:
diff changeset
881 -- Raise_Constraint_Error_Msg --
kono
parents:
diff changeset
882 --------------------------------
kono
parents:
diff changeset
883
kono
parents:
diff changeset
884 procedure Raise_Constraint_Error_Msg
kono
parents:
diff changeset
885 (File : System.Address;
kono
parents:
diff changeset
886 Line : Integer;
kono
parents:
diff changeset
887 Column : Integer;
kono
parents:
diff changeset
888 Msg : System.Address)
kono
parents:
diff changeset
889 is
kono
parents:
diff changeset
890 begin
kono
parents:
diff changeset
891 Raise_With_Location_And_Msg
kono
parents:
diff changeset
892 (Constraint_Error_Def'Access, File, Line, Column, Msg);
kono
parents:
diff changeset
893 end Raise_Constraint_Error_Msg;
kono
parents:
diff changeset
894
kono
parents:
diff changeset
895 -------------------------
kono
parents:
diff changeset
896 -- Complete_Occurrence --
kono
parents:
diff changeset
897 -------------------------
kono
parents:
diff changeset
898
kono
parents:
diff changeset
899 procedure Complete_Occurrence (X : EOA) is
kono
parents:
diff changeset
900 begin
kono
parents:
diff changeset
901 -- Compute the backtrace for this occurrence if the corresponding
kono
parents:
diff changeset
902 -- binder option has been set. Call_Chain takes care of the reraise
kono
parents:
diff changeset
903 -- case.
kono
parents:
diff changeset
904
kono
parents:
diff changeset
905 -- ??? Using Call_Chain here means we are going to walk up the stack
kono
parents:
diff changeset
906 -- once only for backtracing purposes before doing it again for the
kono
parents:
diff changeset
907 -- propagation per se.
kono
parents:
diff changeset
908
kono
parents:
diff changeset
909 -- The first inspection is much lighter, though, as it only requires
kono
parents:
diff changeset
910 -- partial unwinding of each frame. Additionally, although we could use
kono
parents:
diff changeset
911 -- the personality routine to record the addresses while propagating,
kono
parents:
diff changeset
912 -- this method has two drawbacks:
kono
parents:
diff changeset
913
kono
parents:
diff changeset
914 -- 1) the trace is incomplete if the exception is handled since we
kono
parents:
diff changeset
915 -- don't walk past the frame with the handler,
kono
parents:
diff changeset
916
kono
parents:
diff changeset
917 -- and
kono
parents:
diff changeset
918
kono
parents:
diff changeset
919 -- 2) we would miss the frames for which our personality routine is not
kono
parents:
diff changeset
920 -- called, e.g. if C or C++ calls are on the way.
kono
parents:
diff changeset
921
kono
parents:
diff changeset
922 Call_Chain (X);
kono
parents:
diff changeset
923
kono
parents:
diff changeset
924 -- Notify the debugger
kono
parents:
diff changeset
925 Debug_Raise_Exception
kono
parents:
diff changeset
926 (E => SSL.Exception_Data_Ptr (X.Id),
kono
parents:
diff changeset
927 Message => X.Msg (1 .. X.Msg_Length));
kono
parents:
diff changeset
928 end Complete_Occurrence;
kono
parents:
diff changeset
929
kono
parents:
diff changeset
930 ---------------------------------------
kono
parents:
diff changeset
931 -- Complete_And_Propagate_Occurrence --
kono
parents:
diff changeset
932 ---------------------------------------
kono
parents:
diff changeset
933
kono
parents:
diff changeset
934 procedure Complete_And_Propagate_Occurrence (X : EOA) is
kono
parents:
diff changeset
935 begin
kono
parents:
diff changeset
936 Complete_Occurrence (X);
kono
parents:
diff changeset
937 Exception_Propagation.Propagate_Exception (X);
kono
parents:
diff changeset
938 end Complete_And_Propagate_Occurrence;
kono
parents:
diff changeset
939
kono
parents:
diff changeset
940 ---------------------
kono
parents:
diff changeset
941 -- Raise_Exception --
kono
parents:
diff changeset
942 ---------------------
kono
parents:
diff changeset
943
kono
parents:
diff changeset
944 procedure Raise_Exception
kono
parents:
diff changeset
945 (E : Exception_Id;
kono
parents:
diff changeset
946 Message : String := "")
kono
parents:
diff changeset
947 is
kono
parents:
diff changeset
948 EF : Exception_Id := E;
kono
parents:
diff changeset
949 begin
kono
parents:
diff changeset
950 -- Raise CE if E = Null_ID (AI-446)
kono
parents:
diff changeset
951
kono
parents:
diff changeset
952 if E = null then
kono
parents:
diff changeset
953 EF := Constraint_Error'Identity;
kono
parents:
diff changeset
954 end if;
kono
parents:
diff changeset
955
kono
parents:
diff changeset
956 -- Go ahead and raise appropriate exception
kono
parents:
diff changeset
957
kono
parents:
diff changeset
958 Raise_Exception_Always (EF, Message);
kono
parents:
diff changeset
959 end Raise_Exception;
kono
parents:
diff changeset
960
kono
parents:
diff changeset
961 ----------------------------
kono
parents:
diff changeset
962 -- Raise_Exception_Always --
kono
parents:
diff changeset
963 ----------------------------
kono
parents:
diff changeset
964
kono
parents:
diff changeset
965 procedure Raise_Exception_Always
kono
parents:
diff changeset
966 (E : Exception_Id;
kono
parents:
diff changeset
967 Message : String := "")
kono
parents:
diff changeset
968 is
kono
parents:
diff changeset
969 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
970
kono
parents:
diff changeset
971 begin
kono
parents:
diff changeset
972 Exception_Data.Set_Exception_Msg (X, E, Message);
kono
parents:
diff changeset
973
kono
parents:
diff changeset
974 if not ZCX_By_Default then
kono
parents:
diff changeset
975 Abort_Defer.all;
kono
parents:
diff changeset
976 end if;
kono
parents:
diff changeset
977
kono
parents:
diff changeset
978 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
979 end Raise_Exception_Always;
kono
parents:
diff changeset
980
kono
parents:
diff changeset
981 ------------------------------
kono
parents:
diff changeset
982 -- Raise_Exception_No_Defer --
kono
parents:
diff changeset
983 ------------------------------
kono
parents:
diff changeset
984
kono
parents:
diff changeset
985 procedure Raise_Exception_No_Defer
kono
parents:
diff changeset
986 (E : Exception_Id;
kono
parents:
diff changeset
987 Message : String := "")
kono
parents:
diff changeset
988 is
kono
parents:
diff changeset
989 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
990
kono
parents:
diff changeset
991 begin
kono
parents:
diff changeset
992 Exception_Data.Set_Exception_Msg (X, E, Message);
kono
parents:
diff changeset
993
kono
parents:
diff changeset
994 -- Do not call Abort_Defer.all, as specified by the spec
kono
parents:
diff changeset
995
kono
parents:
diff changeset
996 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
997 end Raise_Exception_No_Defer;
kono
parents:
diff changeset
998
kono
parents:
diff changeset
999 -------------------------------------
kono
parents:
diff changeset
1000 -- Raise_From_Controlled_Operation --
kono
parents:
diff changeset
1001 -------------------------------------
kono
parents:
diff changeset
1002
kono
parents:
diff changeset
1003 procedure Raise_From_Controlled_Operation
kono
parents:
diff changeset
1004 (X : Ada.Exceptions.Exception_Occurrence)
kono
parents:
diff changeset
1005 is
kono
parents:
diff changeset
1006 Prefix : constant String := "adjust/finalize raised ";
kono
parents:
diff changeset
1007 Orig_Msg : constant String := Exception_Message (X);
kono
parents:
diff changeset
1008 Orig_Prefix_Length : constant Natural :=
kono
parents:
diff changeset
1009 Integer'Min (Prefix'Length, Orig_Msg'Length);
kono
parents:
diff changeset
1010
kono
parents:
diff changeset
1011 Orig_Prefix : String renames
kono
parents:
diff changeset
1012 Orig_Msg (Orig_Msg'First .. Orig_Msg'First + Orig_Prefix_Length - 1);
kono
parents:
diff changeset
1013
kono
parents:
diff changeset
1014 begin
kono
parents:
diff changeset
1015 -- Message already has the proper prefix, just re-raise
kono
parents:
diff changeset
1016
kono
parents:
diff changeset
1017 if Orig_Prefix = Prefix then
kono
parents:
diff changeset
1018 Raise_Exception_No_Defer
kono
parents:
diff changeset
1019 (E => Program_Error'Identity,
kono
parents:
diff changeset
1020 Message => Orig_Msg);
kono
parents:
diff changeset
1021
kono
parents:
diff changeset
1022 else
kono
parents:
diff changeset
1023 declare
kono
parents:
diff changeset
1024 New_Msg : constant String := Prefix & Exception_Name (X);
kono
parents:
diff changeset
1025
kono
parents:
diff changeset
1026 begin
kono
parents:
diff changeset
1027 -- No message present, just provide our own
kono
parents:
diff changeset
1028
kono
parents:
diff changeset
1029 if Orig_Msg = "" then
kono
parents:
diff changeset
1030 Raise_Exception_No_Defer
kono
parents:
diff changeset
1031 (E => Program_Error'Identity,
kono
parents:
diff changeset
1032 Message => New_Msg);
kono
parents:
diff changeset
1033
kono
parents:
diff changeset
1034 -- Message present, add informational prefix
kono
parents:
diff changeset
1035
kono
parents:
diff changeset
1036 else
kono
parents:
diff changeset
1037 Raise_Exception_No_Defer
kono
parents:
diff changeset
1038 (E => Program_Error'Identity,
kono
parents:
diff changeset
1039 Message => New_Msg & ": " & Orig_Msg);
kono
parents:
diff changeset
1040 end if;
kono
parents:
diff changeset
1041 end;
kono
parents:
diff changeset
1042 end if;
kono
parents:
diff changeset
1043 end Raise_From_Controlled_Operation;
kono
parents:
diff changeset
1044
kono
parents:
diff changeset
1045 -------------------------------------------
kono
parents:
diff changeset
1046 -- Create_Occurrence_From_Signal_Handler --
kono
parents:
diff changeset
1047 -------------------------------------------
kono
parents:
diff changeset
1048
kono
parents:
diff changeset
1049 function Create_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
1050 (E : Exception_Id;
kono
parents:
diff changeset
1051 M : System.Address) return EOA
kono
parents:
diff changeset
1052 is
kono
parents:
diff changeset
1053 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1054
kono
parents:
diff changeset
1055 begin
kono
parents:
diff changeset
1056 Exception_Data.Set_Exception_C_Msg (X, E, M);
kono
parents:
diff changeset
1057
kono
parents:
diff changeset
1058 if not ZCX_By_Default then
kono
parents:
diff changeset
1059 Abort_Defer.all;
kono
parents:
diff changeset
1060 end if;
kono
parents:
diff changeset
1061
kono
parents:
diff changeset
1062 Complete_Occurrence (X);
kono
parents:
diff changeset
1063 return X;
kono
parents:
diff changeset
1064 end Create_Occurrence_From_Signal_Handler;
kono
parents:
diff changeset
1065
kono
parents:
diff changeset
1066 ---------------------------------------------------
kono
parents:
diff changeset
1067 -- Create_Machine_Occurrence_From_Signal_Handler --
kono
parents:
diff changeset
1068 ---------------------------------------------------
kono
parents:
diff changeset
1069
kono
parents:
diff changeset
1070 function Create_Machine_Occurrence_From_Signal_Handler
kono
parents:
diff changeset
1071 (E : Exception_Id;
kono
parents:
diff changeset
1072 M : System.Address) return System.Address
kono
parents:
diff changeset
1073 is
kono
parents:
diff changeset
1074 begin
kono
parents:
diff changeset
1075 return Create_Occurrence_From_Signal_Handler (E, M).Machine_Occurrence;
kono
parents:
diff changeset
1076 end Create_Machine_Occurrence_From_Signal_Handler;
kono
parents:
diff changeset
1077
kono
parents:
diff changeset
1078 -------------------------------
kono
parents:
diff changeset
1079 -- Raise_From_Signal_Handler --
kono
parents:
diff changeset
1080 -------------------------------
kono
parents:
diff changeset
1081
kono
parents:
diff changeset
1082 procedure Raise_From_Signal_Handler
kono
parents:
diff changeset
1083 (E : Exception_Id;
kono
parents:
diff changeset
1084 M : System.Address)
kono
parents:
diff changeset
1085 is
kono
parents:
diff changeset
1086 begin
kono
parents:
diff changeset
1087 Exception_Propagation.Propagate_Exception
kono
parents:
diff changeset
1088 (Create_Occurrence_From_Signal_Handler (E, M));
kono
parents:
diff changeset
1089 end Raise_From_Signal_Handler;
kono
parents:
diff changeset
1090
kono
parents:
diff changeset
1091 -------------------------
kono
parents:
diff changeset
1092 -- Raise_Program_Error --
kono
parents:
diff changeset
1093 -------------------------
kono
parents:
diff changeset
1094
kono
parents:
diff changeset
1095 procedure Raise_Program_Error
kono
parents:
diff changeset
1096 (File : System.Address;
kono
parents:
diff changeset
1097 Line : Integer)
kono
parents:
diff changeset
1098 is
kono
parents:
diff changeset
1099 begin
kono
parents:
diff changeset
1100 Raise_With_Location_And_Msg (Program_Error_Def'Access, File, Line);
kono
parents:
diff changeset
1101 end Raise_Program_Error;
kono
parents:
diff changeset
1102
kono
parents:
diff changeset
1103 -----------------------------
kono
parents:
diff changeset
1104 -- Raise_Program_Error_Msg --
kono
parents:
diff changeset
1105 -----------------------------
kono
parents:
diff changeset
1106
kono
parents:
diff changeset
1107 procedure Raise_Program_Error_Msg
kono
parents:
diff changeset
1108 (File : System.Address;
kono
parents:
diff changeset
1109 Line : Integer;
kono
parents:
diff changeset
1110 Msg : System.Address)
kono
parents:
diff changeset
1111 is
kono
parents:
diff changeset
1112 begin
kono
parents:
diff changeset
1113 Raise_With_Location_And_Msg
kono
parents:
diff changeset
1114 (Program_Error_Def'Access, File, Line, M => Msg);
kono
parents:
diff changeset
1115 end Raise_Program_Error_Msg;
kono
parents:
diff changeset
1116
kono
parents:
diff changeset
1117 -------------------------
kono
parents:
diff changeset
1118 -- Raise_Storage_Error --
kono
parents:
diff changeset
1119 -------------------------
kono
parents:
diff changeset
1120
kono
parents:
diff changeset
1121 procedure Raise_Storage_Error
kono
parents:
diff changeset
1122 (File : System.Address;
kono
parents:
diff changeset
1123 Line : Integer)
kono
parents:
diff changeset
1124 is
kono
parents:
diff changeset
1125 begin
kono
parents:
diff changeset
1126 Raise_With_Location_And_Msg (Storage_Error_Def'Access, File, Line);
kono
parents:
diff changeset
1127 end Raise_Storage_Error;
kono
parents:
diff changeset
1128
kono
parents:
diff changeset
1129 -----------------------------
kono
parents:
diff changeset
1130 -- Raise_Storage_Error_Msg --
kono
parents:
diff changeset
1131 -----------------------------
kono
parents:
diff changeset
1132
kono
parents:
diff changeset
1133 procedure Raise_Storage_Error_Msg
kono
parents:
diff changeset
1134 (File : System.Address;
kono
parents:
diff changeset
1135 Line : Integer;
kono
parents:
diff changeset
1136 Msg : System.Address)
kono
parents:
diff changeset
1137 is
kono
parents:
diff changeset
1138 begin
kono
parents:
diff changeset
1139 Raise_With_Location_And_Msg
kono
parents:
diff changeset
1140 (Storage_Error_Def'Access, File, Line, M => Msg);
kono
parents:
diff changeset
1141 end Raise_Storage_Error_Msg;
kono
parents:
diff changeset
1142
kono
parents:
diff changeset
1143 ---------------------------------
kono
parents:
diff changeset
1144 -- Raise_With_Location_And_Msg --
kono
parents:
diff changeset
1145 ---------------------------------
kono
parents:
diff changeset
1146
kono
parents:
diff changeset
1147 procedure Raise_With_Location_And_Msg
kono
parents:
diff changeset
1148 (E : Exception_Id;
kono
parents:
diff changeset
1149 F : System.Address;
kono
parents:
diff changeset
1150 L : Integer;
kono
parents:
diff changeset
1151 C : Integer := 0;
kono
parents:
diff changeset
1152 M : System.Address := System.Null_Address)
kono
parents:
diff changeset
1153 is
kono
parents:
diff changeset
1154 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1155 begin
kono
parents:
diff changeset
1156 Exception_Data.Set_Exception_C_Msg (X, E, F, L, C, M);
kono
parents:
diff changeset
1157
kono
parents:
diff changeset
1158 if not ZCX_By_Default then
kono
parents:
diff changeset
1159 Abort_Defer.all;
kono
parents:
diff changeset
1160 end if;
kono
parents:
diff changeset
1161
kono
parents:
diff changeset
1162 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
1163 end Raise_With_Location_And_Msg;
kono
parents:
diff changeset
1164
kono
parents:
diff changeset
1165 --------------------
kono
parents:
diff changeset
1166 -- Raise_With_Msg --
kono
parents:
diff changeset
1167 --------------------
kono
parents:
diff changeset
1168
kono
parents:
diff changeset
1169 procedure Raise_With_Msg (E : Exception_Id) is
kono
parents:
diff changeset
1170 Excep : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1171 Ex : constant Exception_Occurrence_Access := Get_Current_Excep.all;
kono
parents:
diff changeset
1172 begin
kono
parents:
diff changeset
1173 Excep.Exception_Raised := False;
kono
parents:
diff changeset
1174 Excep.Id := E;
kono
parents:
diff changeset
1175 Excep.Num_Tracebacks := 0;
kono
parents:
diff changeset
1176 Excep.Pid := Local_Partition_ID;
kono
parents:
diff changeset
1177
kono
parents:
diff changeset
1178 -- Copy the message from the current exception
kono
parents:
diff changeset
1179 -- Change the interface to be called with an occurrence ???
kono
parents:
diff changeset
1180
kono
parents:
diff changeset
1181 Excep.Msg_Length := Ex.Msg_Length;
kono
parents:
diff changeset
1182 Excep.Msg (1 .. Excep.Msg_Length) := Ex.Msg (1 .. Ex.Msg_Length);
kono
parents:
diff changeset
1183
kono
parents:
diff changeset
1184 -- The following is a common pattern, should be abstracted
kono
parents:
diff changeset
1185 -- into a procedure call ???
kono
parents:
diff changeset
1186
kono
parents:
diff changeset
1187 if not ZCX_By_Default then
kono
parents:
diff changeset
1188 Abort_Defer.all;
kono
parents:
diff changeset
1189 end if;
kono
parents:
diff changeset
1190
kono
parents:
diff changeset
1191 Complete_And_Propagate_Occurrence (Excep);
kono
parents:
diff changeset
1192 end Raise_With_Msg;
kono
parents:
diff changeset
1193
kono
parents:
diff changeset
1194 -----------------------------------------
kono
parents:
diff changeset
1195 -- Calls to Run-Time Check Subprograms --
kono
parents:
diff changeset
1196 -----------------------------------------
kono
parents:
diff changeset
1197
kono
parents:
diff changeset
1198 procedure Rcheck_CE_Access_Check
kono
parents:
diff changeset
1199 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1200 is
kono
parents:
diff changeset
1201 begin
kono
parents:
diff changeset
1202 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_00'Address);
kono
parents:
diff changeset
1203 end Rcheck_CE_Access_Check;
kono
parents:
diff changeset
1204
kono
parents:
diff changeset
1205 procedure Rcheck_CE_Null_Access_Parameter
kono
parents:
diff changeset
1206 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1207 is
kono
parents:
diff changeset
1208 begin
kono
parents:
diff changeset
1209 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_01'Address);
kono
parents:
diff changeset
1210 end Rcheck_CE_Null_Access_Parameter;
kono
parents:
diff changeset
1211
kono
parents:
diff changeset
1212 procedure Rcheck_CE_Discriminant_Check
kono
parents:
diff changeset
1213 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1214 is
kono
parents:
diff changeset
1215 begin
kono
parents:
diff changeset
1216 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_02'Address);
kono
parents:
diff changeset
1217 end Rcheck_CE_Discriminant_Check;
kono
parents:
diff changeset
1218
kono
parents:
diff changeset
1219 procedure Rcheck_CE_Divide_By_Zero
kono
parents:
diff changeset
1220 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1221 is
kono
parents:
diff changeset
1222 begin
kono
parents:
diff changeset
1223 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_03'Address);
kono
parents:
diff changeset
1224 end Rcheck_CE_Divide_By_Zero;
kono
parents:
diff changeset
1225
kono
parents:
diff changeset
1226 procedure Rcheck_CE_Explicit_Raise
kono
parents:
diff changeset
1227 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1228 is
kono
parents:
diff changeset
1229 begin
kono
parents:
diff changeset
1230 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_04'Address);
kono
parents:
diff changeset
1231 end Rcheck_CE_Explicit_Raise;
kono
parents:
diff changeset
1232
kono
parents:
diff changeset
1233 procedure Rcheck_CE_Index_Check
kono
parents:
diff changeset
1234 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1235 is
kono
parents:
diff changeset
1236 begin
kono
parents:
diff changeset
1237 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_05'Address);
kono
parents:
diff changeset
1238 end Rcheck_CE_Index_Check;
kono
parents:
diff changeset
1239
kono
parents:
diff changeset
1240 procedure Rcheck_CE_Invalid_Data
kono
parents:
diff changeset
1241 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1242 is
kono
parents:
diff changeset
1243 begin
kono
parents:
diff changeset
1244 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_06'Address);
kono
parents:
diff changeset
1245 end Rcheck_CE_Invalid_Data;
kono
parents:
diff changeset
1246
kono
parents:
diff changeset
1247 procedure Rcheck_CE_Length_Check
kono
parents:
diff changeset
1248 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1249 is
kono
parents:
diff changeset
1250 begin
kono
parents:
diff changeset
1251 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_07'Address);
kono
parents:
diff changeset
1252 end Rcheck_CE_Length_Check;
kono
parents:
diff changeset
1253
kono
parents:
diff changeset
1254 procedure Rcheck_CE_Null_Exception_Id
kono
parents:
diff changeset
1255 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1256 is
kono
parents:
diff changeset
1257 begin
kono
parents:
diff changeset
1258 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_08'Address);
kono
parents:
diff changeset
1259 end Rcheck_CE_Null_Exception_Id;
kono
parents:
diff changeset
1260
kono
parents:
diff changeset
1261 procedure Rcheck_CE_Null_Not_Allowed
kono
parents:
diff changeset
1262 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1263 is
kono
parents:
diff changeset
1264 begin
kono
parents:
diff changeset
1265 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_09'Address);
kono
parents:
diff changeset
1266 end Rcheck_CE_Null_Not_Allowed;
kono
parents:
diff changeset
1267
kono
parents:
diff changeset
1268 procedure Rcheck_CE_Overflow_Check
kono
parents:
diff changeset
1269 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1270 is
kono
parents:
diff changeset
1271 begin
kono
parents:
diff changeset
1272 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_10'Address);
kono
parents:
diff changeset
1273 end Rcheck_CE_Overflow_Check;
kono
parents:
diff changeset
1274
kono
parents:
diff changeset
1275 procedure Rcheck_CE_Partition_Check
kono
parents:
diff changeset
1276 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1277 is
kono
parents:
diff changeset
1278 begin
kono
parents:
diff changeset
1279 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_11'Address);
kono
parents:
diff changeset
1280 end Rcheck_CE_Partition_Check;
kono
parents:
diff changeset
1281
kono
parents:
diff changeset
1282 procedure Rcheck_CE_Range_Check
kono
parents:
diff changeset
1283 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1284 is
kono
parents:
diff changeset
1285 begin
kono
parents:
diff changeset
1286 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_12'Address);
kono
parents:
diff changeset
1287 end Rcheck_CE_Range_Check;
kono
parents:
diff changeset
1288
kono
parents:
diff changeset
1289 procedure Rcheck_CE_Tag_Check
kono
parents:
diff changeset
1290 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1291 is
kono
parents:
diff changeset
1292 begin
kono
parents:
diff changeset
1293 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_13'Address);
kono
parents:
diff changeset
1294 end Rcheck_CE_Tag_Check;
kono
parents:
diff changeset
1295
kono
parents:
diff changeset
1296 procedure Rcheck_PE_Access_Before_Elaboration
kono
parents:
diff changeset
1297 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1298 is
kono
parents:
diff changeset
1299 begin
kono
parents:
diff changeset
1300 Raise_Program_Error_Msg (File, Line, Rmsg_14'Address);
kono
parents:
diff changeset
1301 end Rcheck_PE_Access_Before_Elaboration;
kono
parents:
diff changeset
1302
kono
parents:
diff changeset
1303 procedure Rcheck_PE_Accessibility_Check
kono
parents:
diff changeset
1304 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1305 is
kono
parents:
diff changeset
1306 begin
kono
parents:
diff changeset
1307 Raise_Program_Error_Msg (File, Line, Rmsg_15'Address);
kono
parents:
diff changeset
1308 end Rcheck_PE_Accessibility_Check;
kono
parents:
diff changeset
1309
kono
parents:
diff changeset
1310 procedure Rcheck_PE_Address_Of_Intrinsic
kono
parents:
diff changeset
1311 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1312 is
kono
parents:
diff changeset
1313 begin
kono
parents:
diff changeset
1314 Raise_Program_Error_Msg (File, Line, Rmsg_16'Address);
kono
parents:
diff changeset
1315 end Rcheck_PE_Address_Of_Intrinsic;
kono
parents:
diff changeset
1316
kono
parents:
diff changeset
1317 procedure Rcheck_PE_Aliased_Parameters
kono
parents:
diff changeset
1318 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1319 is
kono
parents:
diff changeset
1320 begin
kono
parents:
diff changeset
1321 Raise_Program_Error_Msg (File, Line, Rmsg_17'Address);
kono
parents:
diff changeset
1322 end Rcheck_PE_Aliased_Parameters;
kono
parents:
diff changeset
1323
kono
parents:
diff changeset
1324 procedure Rcheck_PE_All_Guards_Closed
kono
parents:
diff changeset
1325 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1326 is
kono
parents:
diff changeset
1327 begin
kono
parents:
diff changeset
1328 Raise_Program_Error_Msg (File, Line, Rmsg_18'Address);
kono
parents:
diff changeset
1329 end Rcheck_PE_All_Guards_Closed;
kono
parents:
diff changeset
1330
kono
parents:
diff changeset
1331 procedure Rcheck_PE_Bad_Predicated_Generic_Type
kono
parents:
diff changeset
1332 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1333 is
kono
parents:
diff changeset
1334 begin
kono
parents:
diff changeset
1335 Raise_Program_Error_Msg (File, Line, Rmsg_19'Address);
kono
parents:
diff changeset
1336 end Rcheck_PE_Bad_Predicated_Generic_Type;
kono
parents:
diff changeset
1337
kono
parents:
diff changeset
1338 procedure Rcheck_PE_Current_Task_In_Entry_Body
kono
parents:
diff changeset
1339 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1340 is
kono
parents:
diff changeset
1341 begin
kono
parents:
diff changeset
1342 Raise_Program_Error_Msg (File, Line, Rmsg_20'Address);
kono
parents:
diff changeset
1343 end Rcheck_PE_Current_Task_In_Entry_Body;
kono
parents:
diff changeset
1344
kono
parents:
diff changeset
1345 procedure Rcheck_PE_Duplicated_Entry_Address
kono
parents:
diff changeset
1346 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1347 is
kono
parents:
diff changeset
1348 begin
kono
parents:
diff changeset
1349 Raise_Program_Error_Msg (File, Line, Rmsg_21'Address);
kono
parents:
diff changeset
1350 end Rcheck_PE_Duplicated_Entry_Address;
kono
parents:
diff changeset
1351
kono
parents:
diff changeset
1352 procedure Rcheck_PE_Explicit_Raise
kono
parents:
diff changeset
1353 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1354 is
kono
parents:
diff changeset
1355 begin
kono
parents:
diff changeset
1356 Raise_Program_Error_Msg (File, Line, Rmsg_22'Address);
kono
parents:
diff changeset
1357 end Rcheck_PE_Explicit_Raise;
kono
parents:
diff changeset
1358
kono
parents:
diff changeset
1359 procedure Rcheck_PE_Implicit_Return
kono
parents:
diff changeset
1360 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1361 is
kono
parents:
diff changeset
1362 begin
kono
parents:
diff changeset
1363 Raise_Program_Error_Msg (File, Line, Rmsg_24'Address);
kono
parents:
diff changeset
1364 end Rcheck_PE_Implicit_Return;
kono
parents:
diff changeset
1365
kono
parents:
diff changeset
1366 procedure Rcheck_PE_Misaligned_Address_Value
kono
parents:
diff changeset
1367 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1368 is
kono
parents:
diff changeset
1369 begin
kono
parents:
diff changeset
1370 Raise_Program_Error_Msg (File, Line, Rmsg_25'Address);
kono
parents:
diff changeset
1371 end Rcheck_PE_Misaligned_Address_Value;
kono
parents:
diff changeset
1372
kono
parents:
diff changeset
1373 procedure Rcheck_PE_Missing_Return
kono
parents:
diff changeset
1374 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1375 is
kono
parents:
diff changeset
1376 begin
kono
parents:
diff changeset
1377 Raise_Program_Error_Msg (File, Line, Rmsg_26'Address);
kono
parents:
diff changeset
1378 end Rcheck_PE_Missing_Return;
kono
parents:
diff changeset
1379
kono
parents:
diff changeset
1380 procedure Rcheck_PE_Non_Transportable_Actual
kono
parents:
diff changeset
1381 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1382 is
kono
parents:
diff changeset
1383 begin
kono
parents:
diff changeset
1384 Raise_Program_Error_Msg (File, Line, Rmsg_31'Address);
kono
parents:
diff changeset
1385 end Rcheck_PE_Non_Transportable_Actual;
kono
parents:
diff changeset
1386
kono
parents:
diff changeset
1387 procedure Rcheck_PE_Overlaid_Controlled_Object
kono
parents:
diff changeset
1388 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1389 is
kono
parents:
diff changeset
1390 begin
kono
parents:
diff changeset
1391 Raise_Program_Error_Msg (File, Line, Rmsg_27'Address);
kono
parents:
diff changeset
1392 end Rcheck_PE_Overlaid_Controlled_Object;
kono
parents:
diff changeset
1393
kono
parents:
diff changeset
1394 procedure Rcheck_PE_Potentially_Blocking_Operation
kono
parents:
diff changeset
1395 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1396 is
kono
parents:
diff changeset
1397 begin
kono
parents:
diff changeset
1398 Raise_Program_Error_Msg (File, Line, Rmsg_28'Address);
kono
parents:
diff changeset
1399 end Rcheck_PE_Potentially_Blocking_Operation;
kono
parents:
diff changeset
1400
kono
parents:
diff changeset
1401 procedure Rcheck_PE_Stream_Operation_Not_Allowed
kono
parents:
diff changeset
1402 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1403 is
kono
parents:
diff changeset
1404 begin
kono
parents:
diff changeset
1405 Raise_Program_Error_Msg (File, Line, Rmsg_36'Address);
kono
parents:
diff changeset
1406 end Rcheck_PE_Stream_Operation_Not_Allowed;
kono
parents:
diff changeset
1407
kono
parents:
diff changeset
1408 procedure Rcheck_PE_Stubbed_Subprogram_Called
kono
parents:
diff changeset
1409 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1410 is
kono
parents:
diff changeset
1411 begin
kono
parents:
diff changeset
1412 Raise_Program_Error_Msg (File, Line, Rmsg_29'Address);
kono
parents:
diff changeset
1413 end Rcheck_PE_Stubbed_Subprogram_Called;
kono
parents:
diff changeset
1414
kono
parents:
diff changeset
1415 procedure Rcheck_PE_Unchecked_Union_Restriction
kono
parents:
diff changeset
1416 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1417 is
kono
parents:
diff changeset
1418 begin
kono
parents:
diff changeset
1419 Raise_Program_Error_Msg (File, Line, Rmsg_30'Address);
kono
parents:
diff changeset
1420 end Rcheck_PE_Unchecked_Union_Restriction;
kono
parents:
diff changeset
1421
kono
parents:
diff changeset
1422 procedure Rcheck_SE_Empty_Storage_Pool
kono
parents:
diff changeset
1423 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1424 is
kono
parents:
diff changeset
1425 begin
kono
parents:
diff changeset
1426 Raise_Storage_Error_Msg (File, Line, Rmsg_32'Address);
kono
parents:
diff changeset
1427 end Rcheck_SE_Empty_Storage_Pool;
kono
parents:
diff changeset
1428
kono
parents:
diff changeset
1429 procedure Rcheck_SE_Explicit_Raise
kono
parents:
diff changeset
1430 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1431 is
kono
parents:
diff changeset
1432 begin
kono
parents:
diff changeset
1433 Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address);
kono
parents:
diff changeset
1434 end Rcheck_SE_Explicit_Raise;
kono
parents:
diff changeset
1435
kono
parents:
diff changeset
1436 procedure Rcheck_SE_Infinite_Recursion
kono
parents:
diff changeset
1437 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1438 is
kono
parents:
diff changeset
1439 begin
kono
parents:
diff changeset
1440 Raise_Storage_Error_Msg (File, Line, Rmsg_34'Address);
kono
parents:
diff changeset
1441 end Rcheck_SE_Infinite_Recursion;
kono
parents:
diff changeset
1442
kono
parents:
diff changeset
1443 procedure Rcheck_SE_Object_Too_Large
kono
parents:
diff changeset
1444 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1445 is
kono
parents:
diff changeset
1446 begin
kono
parents:
diff changeset
1447 Raise_Storage_Error_Msg (File, Line, Rmsg_35'Address);
kono
parents:
diff changeset
1448 end Rcheck_SE_Object_Too_Large;
kono
parents:
diff changeset
1449
kono
parents:
diff changeset
1450 procedure Rcheck_CE_Access_Check_Ext
kono
parents:
diff changeset
1451 (File : System.Address; Line, Column : Integer)
kono
parents:
diff changeset
1452 is
kono
parents:
diff changeset
1453 begin
kono
parents:
diff changeset
1454 Raise_Constraint_Error_Msg (File, Line, Column, Rmsg_00'Address);
kono
parents:
diff changeset
1455 end Rcheck_CE_Access_Check_Ext;
kono
parents:
diff changeset
1456
kono
parents:
diff changeset
1457 procedure Rcheck_CE_Index_Check_Ext
kono
parents:
diff changeset
1458 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1459 is
kono
parents:
diff changeset
1460 Msg : constant String :=
kono
parents:
diff changeset
1461 Rmsg_05 (Rmsg_05'First .. Rmsg_05'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1462 & "index " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1463 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1464 begin
kono
parents:
diff changeset
1465 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1466 end Rcheck_CE_Index_Check_Ext;
kono
parents:
diff changeset
1467
kono
parents:
diff changeset
1468 procedure Rcheck_CE_Invalid_Data_Ext
kono
parents:
diff changeset
1469 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1470 is
kono
parents:
diff changeset
1471 Msg : constant String :=
kono
parents:
diff changeset
1472 Rmsg_06 (Rmsg_06'First .. Rmsg_06'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1473 & "value " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1474 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1475 begin
kono
parents:
diff changeset
1476 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1477 end Rcheck_CE_Invalid_Data_Ext;
kono
parents:
diff changeset
1478
kono
parents:
diff changeset
1479 procedure Rcheck_CE_Range_Check_Ext
kono
parents:
diff changeset
1480 (File : System.Address; Line, Column, Index, First, Last : Integer)
kono
parents:
diff changeset
1481 is
kono
parents:
diff changeset
1482 Msg : constant String :=
kono
parents:
diff changeset
1483 Rmsg_12 (Rmsg_12'First .. Rmsg_12'Last - 1) & ASCII.LF
kono
parents:
diff changeset
1484 & "value " & Image (Index) & " not in " & Image (First)
kono
parents:
diff changeset
1485 & ".." & Image (Last) & ASCII.NUL;
kono
parents:
diff changeset
1486 begin
kono
parents:
diff changeset
1487 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
kono
parents:
diff changeset
1488 end Rcheck_CE_Range_Check_Ext;
kono
parents:
diff changeset
1489
kono
parents:
diff changeset
1490 procedure Rcheck_PE_Finalize_Raised_Exception
kono
parents:
diff changeset
1491 (File : System.Address; Line : Integer)
kono
parents:
diff changeset
1492 is
kono
parents:
diff changeset
1493 X : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1494
kono
parents:
diff changeset
1495 begin
kono
parents:
diff changeset
1496 -- This is "finalize/adjust raised exception". This subprogram is always
kono
parents:
diff changeset
1497 -- called with abort deferred, unlike all other Rcheck_* subprograms, it
kono
parents:
diff changeset
1498 -- needs to call Raise_Exception_No_Defer.
kono
parents:
diff changeset
1499
kono
parents:
diff changeset
1500 -- This is consistent with Raise_From_Controlled_Operation
kono
parents:
diff changeset
1501
kono
parents:
diff changeset
1502 Exception_Data.Set_Exception_C_Msg
kono
parents:
diff changeset
1503 (X, Program_Error_Def'Access, File, Line, 0, Rmsg_23'Address);
kono
parents:
diff changeset
1504 Complete_And_Propagate_Occurrence (X);
kono
parents:
diff changeset
1505 end Rcheck_PE_Finalize_Raised_Exception;
kono
parents:
diff changeset
1506
kono
parents:
diff changeset
1507 -------------
kono
parents:
diff changeset
1508 -- Reraise --
kono
parents:
diff changeset
1509 -------------
kono
parents:
diff changeset
1510
kono
parents:
diff changeset
1511 procedure Reraise is
kono
parents:
diff changeset
1512 Excep : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1513 Saved_MO : constant System.Address := Excep.Machine_Occurrence;
kono
parents:
diff changeset
1514
kono
parents:
diff changeset
1515 begin
kono
parents:
diff changeset
1516 if not ZCX_By_Default then
kono
parents:
diff changeset
1517 Abort_Defer.all;
kono
parents:
diff changeset
1518 end if;
kono
parents:
diff changeset
1519
kono
parents:
diff changeset
1520 Save_Occurrence (Excep.all, Get_Current_Excep.all.all);
kono
parents:
diff changeset
1521 Excep.Machine_Occurrence := Saved_MO;
kono
parents:
diff changeset
1522 Complete_And_Propagate_Occurrence (Excep);
kono
parents:
diff changeset
1523 end Reraise;
kono
parents:
diff changeset
1524
kono
parents:
diff changeset
1525 --------------------------------------
kono
parents:
diff changeset
1526 -- Reraise_Library_Exception_If_Any --
kono
parents:
diff changeset
1527 --------------------------------------
kono
parents:
diff changeset
1528
kono
parents:
diff changeset
1529 procedure Reraise_Library_Exception_If_Any is
kono
parents:
diff changeset
1530 LE : Exception_Occurrence;
kono
parents:
diff changeset
1531
kono
parents:
diff changeset
1532 begin
kono
parents:
diff changeset
1533 if Library_Exception_Set then
kono
parents:
diff changeset
1534 LE := Library_Exception;
kono
parents:
diff changeset
1535
kono
parents:
diff changeset
1536 if LE.Id = Null_Id then
kono
parents:
diff changeset
1537 Raise_Exception_No_Defer
kono
parents:
diff changeset
1538 (E => Program_Error'Identity,
kono
parents:
diff changeset
1539 Message => "finalize/adjust raised exception");
kono
parents:
diff changeset
1540 else
kono
parents:
diff changeset
1541 Raise_From_Controlled_Operation (LE);
kono
parents:
diff changeset
1542 end if;
kono
parents:
diff changeset
1543 end if;
kono
parents:
diff changeset
1544 end Reraise_Library_Exception_If_Any;
kono
parents:
diff changeset
1545
kono
parents:
diff changeset
1546 ------------------------
kono
parents:
diff changeset
1547 -- Reraise_Occurrence --
kono
parents:
diff changeset
1548 ------------------------
kono
parents:
diff changeset
1549
kono
parents:
diff changeset
1550 procedure Reraise_Occurrence (X : Exception_Occurrence) is
kono
parents:
diff changeset
1551 begin
kono
parents:
diff changeset
1552 if X.Id = null then
kono
parents:
diff changeset
1553 return;
kono
parents:
diff changeset
1554 else
kono
parents:
diff changeset
1555 Reraise_Occurrence_Always (X);
kono
parents:
diff changeset
1556 end if;
kono
parents:
diff changeset
1557 end Reraise_Occurrence;
kono
parents:
diff changeset
1558
kono
parents:
diff changeset
1559 -------------------------------
kono
parents:
diff changeset
1560 -- Reraise_Occurrence_Always --
kono
parents:
diff changeset
1561 -------------------------------
kono
parents:
diff changeset
1562
kono
parents:
diff changeset
1563 procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
kono
parents:
diff changeset
1564 begin
kono
parents:
diff changeset
1565 if not ZCX_By_Default then
kono
parents:
diff changeset
1566 Abort_Defer.all;
kono
parents:
diff changeset
1567 end if;
kono
parents:
diff changeset
1568
kono
parents:
diff changeset
1569 Reraise_Occurrence_No_Defer (X);
kono
parents:
diff changeset
1570 end Reraise_Occurrence_Always;
kono
parents:
diff changeset
1571
kono
parents:
diff changeset
1572 ---------------------------------
kono
parents:
diff changeset
1573 -- Reraise_Occurrence_No_Defer --
kono
parents:
diff changeset
1574 ---------------------------------
kono
parents:
diff changeset
1575
kono
parents:
diff changeset
1576 procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
kono
parents:
diff changeset
1577 Excep : constant EOA := Exception_Propagation.Allocate_Occurrence;
kono
parents:
diff changeset
1578 Saved_MO : constant System.Address := Excep.Machine_Occurrence;
kono
parents:
diff changeset
1579 begin
kono
parents:
diff changeset
1580 Save_Occurrence (Excep.all, X);
kono
parents:
diff changeset
1581 Excep.Machine_Occurrence := Saved_MO;
kono
parents:
diff changeset
1582 Complete_And_Propagate_Occurrence (Excep);
kono
parents:
diff changeset
1583 end Reraise_Occurrence_No_Defer;
kono
parents:
diff changeset
1584
kono
parents:
diff changeset
1585 ---------------------
kono
parents:
diff changeset
1586 -- Save_Occurrence --
kono
parents:
diff changeset
1587 ---------------------
kono
parents:
diff changeset
1588
kono
parents:
diff changeset
1589 procedure Save_Occurrence
kono
parents:
diff changeset
1590 (Target : out Exception_Occurrence;
kono
parents:
diff changeset
1591 Source : Exception_Occurrence)
kono
parents:
diff changeset
1592 is
kono
parents:
diff changeset
1593 begin
kono
parents:
diff changeset
1594 -- As the machine occurrence might be a data that must be finalized
kono
parents:
diff changeset
1595 -- (outside any Ada mechanism), do not copy it
kono
parents:
diff changeset
1596
kono
parents:
diff changeset
1597 Target.Id := Source.Id;
kono
parents:
diff changeset
1598 Target.Machine_Occurrence := System.Null_Address;
kono
parents:
diff changeset
1599 Target.Msg_Length := Source.Msg_Length;
kono
parents:
diff changeset
1600 Target.Num_Tracebacks := Source.Num_Tracebacks;
kono
parents:
diff changeset
1601 Target.Pid := Source.Pid;
kono
parents:
diff changeset
1602
kono
parents:
diff changeset
1603 Target.Msg (1 .. Target.Msg_Length) :=
kono
parents:
diff changeset
1604 Source.Msg (1 .. Target.Msg_Length);
kono
parents:
diff changeset
1605
kono
parents:
diff changeset
1606 Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
kono
parents:
diff changeset
1607 Source.Tracebacks (1 .. Target.Num_Tracebacks);
kono
parents:
diff changeset
1608 end Save_Occurrence;
kono
parents:
diff changeset
1609
kono
parents:
diff changeset
1610 function Save_Occurrence (Source : Exception_Occurrence) return EOA is
kono
parents:
diff changeset
1611 Target : constant EOA := new Exception_Occurrence;
kono
parents:
diff changeset
1612 begin
kono
parents:
diff changeset
1613 Save_Occurrence (Target.all, Source);
kono
parents:
diff changeset
1614 return Target;
kono
parents:
diff changeset
1615 end Save_Occurrence;
kono
parents:
diff changeset
1616
kono
parents:
diff changeset
1617 -------------------
kono
parents:
diff changeset
1618 -- String_To_EId --
kono
parents:
diff changeset
1619 -------------------
kono
parents:
diff changeset
1620
kono
parents:
diff changeset
1621 function String_To_EId (S : String) return Exception_Id
kono
parents:
diff changeset
1622 renames Stream_Attributes.String_To_EId;
kono
parents:
diff changeset
1623
kono
parents:
diff changeset
1624 ------------------
kono
parents:
diff changeset
1625 -- String_To_EO --
kono
parents:
diff changeset
1626 ------------------
kono
parents:
diff changeset
1627
kono
parents:
diff changeset
1628 function String_To_EO (S : String) return Exception_Occurrence
kono
parents:
diff changeset
1629 renames Stream_Attributes.String_To_EO;
kono
parents:
diff changeset
1630
kono
parents:
diff changeset
1631 ---------------
kono
parents:
diff changeset
1632 -- To_Stderr --
kono
parents:
diff changeset
1633 ---------------
kono
parents:
diff changeset
1634
kono
parents:
diff changeset
1635 procedure To_Stderr (C : Character) is
kono
parents:
diff changeset
1636 procedure Put_Char_Stderr (C : Character);
kono
parents:
diff changeset
1637 pragma Import (C, Put_Char_Stderr, "put_char_stderr");
kono
parents:
diff changeset
1638 begin
kono
parents:
diff changeset
1639 Put_Char_Stderr (C);
kono
parents:
diff changeset
1640 end To_Stderr;
kono
parents:
diff changeset
1641
kono
parents:
diff changeset
1642 procedure To_Stderr (S : String) is
kono
parents:
diff changeset
1643 begin
kono
parents:
diff changeset
1644 for J in S'Range loop
kono
parents:
diff changeset
1645 if S (J) /= ASCII.CR then
kono
parents:
diff changeset
1646 To_Stderr (S (J));
kono
parents:
diff changeset
1647 end if;
kono
parents:
diff changeset
1648 end loop;
kono
parents:
diff changeset
1649 end To_Stderr;
kono
parents:
diff changeset
1650
kono
parents:
diff changeset
1651 -------------------------
kono
parents:
diff changeset
1652 -- Transfer_Occurrence --
kono
parents:
diff changeset
1653 -------------------------
kono
parents:
diff changeset
1654
kono
parents:
diff changeset
1655 procedure Transfer_Occurrence
kono
parents:
diff changeset
1656 (Target : Exception_Occurrence_Access;
kono
parents:
diff changeset
1657 Source : Exception_Occurrence)
kono
parents:
diff changeset
1658 is
kono
parents:
diff changeset
1659 begin
kono
parents:
diff changeset
1660 Save_Occurrence (Target.all, Source);
kono
parents:
diff changeset
1661 end Transfer_Occurrence;
kono
parents:
diff changeset
1662
kono
parents:
diff changeset
1663 ------------------------
kono
parents:
diff changeset
1664 -- Triggered_By_Abort --
kono
parents:
diff changeset
1665 ------------------------
kono
parents:
diff changeset
1666
kono
parents:
diff changeset
1667 function Triggered_By_Abort return Boolean is
kono
parents:
diff changeset
1668 Ex : constant Exception_Occurrence_Access := Get_Current_Excep.all;
kono
parents:
diff changeset
1669 begin
kono
parents:
diff changeset
1670 return Ex /= null
kono
parents:
diff changeset
1671 and then Exception_Identity (Ex.all) = Standard'Abort_Signal'Identity;
kono
parents:
diff changeset
1672 end Triggered_By_Abort;
kono
parents:
diff changeset
1673
kono
parents:
diff changeset
1674 -------------------------
kono
parents:
diff changeset
1675 -- Wide_Exception_Name --
kono
parents:
diff changeset
1676 -------------------------
kono
parents:
diff changeset
1677
kono
parents:
diff changeset
1678 WC_Encoding : Character;
kono
parents:
diff changeset
1679 pragma Import (C, WC_Encoding, "__gl_wc_encoding");
kono
parents:
diff changeset
1680 -- Encoding method for source, as exported by binder
kono
parents:
diff changeset
1681
kono
parents:
diff changeset
1682 function Wide_Exception_Name
kono
parents:
diff changeset
1683 (Id : Exception_Id) return Wide_String
kono
parents:
diff changeset
1684 is
kono
parents:
diff changeset
1685 S : constant String := Exception_Name (Id);
kono
parents:
diff changeset
1686 W : Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1687 L : Natural;
kono
parents:
diff changeset
1688 begin
kono
parents:
diff changeset
1689 String_To_Wide_String
kono
parents:
diff changeset
1690 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1691 return W (1 .. L);
kono
parents:
diff changeset
1692 end Wide_Exception_Name;
kono
parents:
diff changeset
1693
kono
parents:
diff changeset
1694 function Wide_Exception_Name
kono
parents:
diff changeset
1695 (X : Exception_Occurrence) return Wide_String
kono
parents:
diff changeset
1696 is
kono
parents:
diff changeset
1697 S : constant String := Exception_Name (X);
kono
parents:
diff changeset
1698 W : Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1699 L : Natural;
kono
parents:
diff changeset
1700 begin
kono
parents:
diff changeset
1701 String_To_Wide_String
kono
parents:
diff changeset
1702 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1703 return W (1 .. L);
kono
parents:
diff changeset
1704 end Wide_Exception_Name;
kono
parents:
diff changeset
1705
kono
parents:
diff changeset
1706 ----------------------------
kono
parents:
diff changeset
1707 -- Wide_Wide_Exception_Name --
kono
parents:
diff changeset
1708 -----------------------------
kono
parents:
diff changeset
1709
kono
parents:
diff changeset
1710 function Wide_Wide_Exception_Name
kono
parents:
diff changeset
1711 (Id : Exception_Id) return Wide_Wide_String
kono
parents:
diff changeset
1712 is
kono
parents:
diff changeset
1713 S : constant String := Exception_Name (Id);
kono
parents:
diff changeset
1714 W : Wide_Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1715 L : Natural;
kono
parents:
diff changeset
1716 begin
kono
parents:
diff changeset
1717 String_To_Wide_Wide_String
kono
parents:
diff changeset
1718 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1719 return W (1 .. L);
kono
parents:
diff changeset
1720 end Wide_Wide_Exception_Name;
kono
parents:
diff changeset
1721
kono
parents:
diff changeset
1722 function Wide_Wide_Exception_Name
kono
parents:
diff changeset
1723 (X : Exception_Occurrence) return Wide_Wide_String
kono
parents:
diff changeset
1724 is
kono
parents:
diff changeset
1725 S : constant String := Exception_Name (X);
kono
parents:
diff changeset
1726 W : Wide_Wide_String (1 .. S'Length);
kono
parents:
diff changeset
1727 L : Natural;
kono
parents:
diff changeset
1728 begin
kono
parents:
diff changeset
1729 String_To_Wide_Wide_String
kono
parents:
diff changeset
1730 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
kono
parents:
diff changeset
1731 return W (1 .. L);
kono
parents:
diff changeset
1732 end Wide_Wide_Exception_Name;
kono
parents:
diff changeset
1733
kono
parents:
diff changeset
1734 --------------------------
kono
parents:
diff changeset
1735 -- Code_Address_For_ZZZ --
kono
parents:
diff changeset
1736 --------------------------
kono
parents:
diff changeset
1737
kono
parents:
diff changeset
1738 -- This function gives us the end of the PC range for addresses
kono
parents:
diff changeset
1739 -- within the exception unit itself. We hope that gigi/gcc keeps all the
kono
parents:
diff changeset
1740 -- procedures in their original order.
kono
parents:
diff changeset
1741
kono
parents:
diff changeset
1742 function Code_Address_For_ZZZ return System.Address is
kono
parents:
diff changeset
1743 begin
kono
parents:
diff changeset
1744 <<Start_Of_ZZZ>>
kono
parents:
diff changeset
1745 return Start_Of_ZZZ'Address;
kono
parents:
diff changeset
1746 end Code_Address_For_ZZZ;
kono
parents:
diff changeset
1747
kono
parents:
diff changeset
1748 end Ada.Exceptions;