1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- A D A . E X C E P T I O N S --
9 -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This version of Ada.Exceptions fully supports both Ada 95 and Ada 2005.
33 -- It is used in all situations except for the build of the compiler and
34 -- other basic tools. For these latter builds, we use an Ada 95-only version.
36 -- The reason for this splitting off of a separate version is that bootstrap
37 -- compilers often will be used that do not support Ada 2005 features, and
38 -- Ada.Exceptions is part of the compiler sources.
40 pragma Style_Checks (All_Checks);
41 -- No subprogram ordering check, due to logical grouping
44 -- We must turn polling off for this unit, because otherwise we get
45 -- elaboration circularities with System.Exception_Tables.
47 with System; use System;
48 with System.Exceptions; use System.Exceptions;
49 with System.Standard_Library; use System.Standard_Library;
50 with System.Soft_Links; use System.Soft_Links;
51 with System.WCh_Con; use System.WCh_Con;
52 with System.WCh_StW; use System.WCh_StW;
54 package body Ada.Exceptions is
56 pragma Suppress (All_Checks);
57 -- We definitely do not want exceptions occurring within this unit, or
58 -- we are in big trouble. If an exceptional situation does occur, better
59 -- that it not be raised, since raising it can cause confusing chaos.
61 -----------------------
62 -- Local Subprograms --
63 -----------------------
65 -- Note: the exported subprograms in this package body are called directly
66 -- from C clients using the given external name, even though they are not
67 -- technically visible in the Ada sense.
69 function Code_Address_For_AAA return System.Address;
70 function Code_Address_For_ZZZ return System.Address;
71 -- Return start and end of procedures in this package
73 -- These procedures are used to provide exclusion bounds in
74 -- calls to Call_Chain at exception raise points from this unit. The
75 -- purpose is to arrange for the exception tracebacks not to include
76 -- frames from routines involved in the raise process, as these are
77 -- meaningless from the user's standpoint.
79 -- For these bounds to be meaningful, we need to ensure that the object
80 -- code for the routines involved in processing a raise is located after
81 -- the object code Code_Address_For_AAA and before the object code
82 -- Code_Address_For_ZZZ. This will indeed be the case as long as the
83 -- following rules are respected:
85 -- 1) The bodies of the subprograms involved in processing a raise
86 -- are located after the body of Code_Address_For_AAA and before the
87 -- body of Code_Address_For_ZZZ.
89 -- 2) No pragma Inline applies to any of these subprograms, as this
90 -- could delay the corresponding assembly output until the end of
93 procedure Call_Chain (Excep : EOA);
94 -- Store up to Max_Tracebacks in Excep, corresponding to the current
97 function Image (Index : Integer) return String;
98 -- Return string image corresponding to Index
100 procedure To_Stderr (S : String);
101 pragma Export (Ada, To_Stderr, "__gnat_to_stderr");
102 -- Little routine to output string to stderr that is also used
103 -- in the tasking run time.
105 procedure To_Stderr (C : Character);
106 pragma Inline (To_Stderr);
107 pragma Export (Ada, To_Stderr, "__gnat_to_stderr_char");
108 -- Little routine to output a character to stderr, used by some of
109 -- the separate units below.
111 package Exception_Data is
113 ---------------------------------
114 -- Exception messages routines --
115 ---------------------------------
117 procedure Set_Exception_C_Msg
119 Msg1 : System.Address;
121 Column : Integer := 0;
122 Msg2 : System.Address := System.Null_Address);
123 -- This routine is called to setup the exception referenced by the
124 -- Current_Excep field in the TSD to contain the indicated Id value
125 -- and message. Msg1 is a null terminated string which is generated
126 -- as the exception message. If line is non-zero, then a colon and
127 -- the decimal representation of this integer is appended to the
128 -- message. Ditto for Column. When Msg2 is non-null, a space and this
129 -- additional null terminated string is added to the message.
131 procedure Set_Exception_Msg
134 -- This routine is called to setup the exception referenced by the
135 -- Current_Excep field in the TSD to contain the indicated Id value
136 -- and message. Message is a string which is generated as the
137 -- exception message.
139 --------------------------------------
140 -- Exception information subprogram --
141 --------------------------------------
143 function Exception_Information (X : Exception_Occurrence) return String;
144 -- The format of the exception information is as follows:
146 -- Exception_Name: <exception name> (as in Exception_Name)
147 -- Message: <message> (only if Exception_Message is empty)
148 -- PID=nnnn (only if != 0)
149 -- Call stack traceback locations: (only if at least one location)
150 -- <0xyyyyyyyy 0xyyyyyyyy ...> (is recorded)
152 -- The lines are separated by a ASCII.LF character.
153 -- The nnnn is the partition Id given as decimal digits.
154 -- The 0x... line represents traceback program counter locations, in
155 -- execution order with the first one being the exception location. It
158 -- The Exception_Name and Message lines are omitted in the abort
159 -- signal case, since this is not really an exception.
161 -- !! If the format of the generated string is changed, please note
162 -- !! that an equivalent modification to the routine String_To_EO must
163 -- !! be made to preserve proper functioning of the stream attributes.
165 ---------------------------------------
166 -- Exception backtracing subprograms --
167 ---------------------------------------
169 -- What is automatically output when exception tracing is on is the
170 -- usual exception information with the call chain backtrace possibly
171 -- tailored by a backtrace decorator. Modifying Exception_Information
172 -- itself is not a good idea because the decorated output is completely
173 -- out of control and would break all our code related to the streaming
174 -- of exceptions. We then provide an alternative function to compute
175 -- the possibly tailored output, which is equivalent if no decorator is
178 function Tailored_Exception_Information
179 (X : Exception_Occurrence) return String;
180 -- Exception information to be output in the case of automatic tracing
181 -- requested through GNAT.Exception_Traces.
183 -- This is the same as Exception_Information if no backtrace decorator
184 -- is currently in place. Otherwise, this is Exception_Information with
185 -- the call chain raw addresses replaced by the result of a call to the
186 -- current decorator provided with the call chain addresses.
189 (Ada, Tailored_Exception_Information,
190 "__gnat_tailored_exception_information");
191 -- This is currently used by System.Tasking.Stages
195 package Exception_Traces is
198 -- Imports Tailored_Exception_Information
200 ----------------------------------------------
201 -- Run-Time Exception Notification Routines --
202 ----------------------------------------------
204 -- These subprograms provide a common run-time interface to trigger the
205 -- actions required when an exception is about to be propagated (e.g.
206 -- user specified actions or output of exception information). They are
207 -- exported to be usable by the Ada exception handling personality
208 -- routine when the GCC 3 mechanism is used.
210 procedure Notify_Handled_Exception;
212 (C, Notify_Handled_Exception, "__gnat_notify_handled_exception");
213 -- This routine is called for a handled occurrence is about to be
216 procedure Notify_Unhandled_Exception;
218 (C, Notify_Unhandled_Exception, "__gnat_notify_unhandled_exception");
219 -- This routine is called when an unhandled occurrence is about to be
222 procedure Unhandled_Exception_Terminate;
223 pragma No_Return (Unhandled_Exception_Terminate);
224 -- This procedure is called to terminate execution following an
225 -- unhandled exception. The exception information, including
226 -- traceback if available is output, and execution is then
227 -- terminated. Note that at the point where this routine is
228 -- called, the stack has typically been destroyed.
230 end Exception_Traces;
232 package Exception_Propagation is
234 use Exception_Traces;
235 -- Imports Notify_Unhandled_Exception and
236 -- Unhandled_Exception_Terminate
238 ------------------------------------
239 -- Exception propagation routines --
240 ------------------------------------
242 procedure Setup_Exception
245 Reraised : Boolean := False);
246 -- Perform the necessary operations to prepare the propagation of Excep
247 -- in a task where Current is the current occurrence. Excep is assumed
248 -- to be a valid (non null) pointer.
250 -- This should be called before any (re-)setting of the current
251 -- occurrence. Any such (re-)setting shall take care *not* to clobber
252 -- the Private_Data component.
254 -- Having Current provided as an argument (instead of retrieving it via
255 -- Get_Current_Excep internally) is required to allow one task to setup
256 -- an exception for another task, which is used by Transfer_Occurrence.
258 procedure Propagate_Exception
260 From_Signal_Handler : Boolean);
261 pragma No_Return (Propagate_Exception);
262 -- This procedure propagates the exception represented by the occurrence
263 -- referenced by Current_Excep in the TSD for the current task.
265 end Exception_Propagation;
267 package Stream_Attributes is
269 --------------------------------
270 -- Stream attributes routines --
271 --------------------------------
273 function EId_To_String (X : Exception_Id) return String;
274 function String_To_EId (S : String) return Exception_Id;
275 -- Functions for implementing Exception_Id stream attributes
277 function EO_To_String (X : Exception_Occurrence) return String;
278 function String_To_EO (S : String) return Exception_Occurrence;
279 -- Functions for implementing Exception_Occurrence stream
282 end Stream_Attributes;
284 procedure Raise_Current_Excep (E : Exception_Id);
285 pragma No_Return (Raise_Current_Excep);
286 pragma Export (C, Raise_Current_Excep, "__gnat_raise_nodefer_with_msg");
287 -- This is a simple wrapper to Exception_Propagation.Propagate_Exception
288 -- setting the From_Signal_Handler argument to False.
290 -- This external name for Raise_Current_Excep is historical, and probably
291 -- should be changed but for now we keep it, because gdb and gigi know
294 procedure Raise_Exception_No_Defer
295 (E : Exception_Id; Message : String := "");
297 (Ada, Raise_Exception_No_Defer,
298 "ada__exceptions__raise_exception_no_defer");
299 pragma No_Return (Raise_Exception_No_Defer);
300 -- Similar to Raise_Exception, but with no abort deferral
302 procedure Raise_With_Msg (E : Exception_Id);
303 pragma No_Return (Raise_With_Msg);
304 pragma Export (C, Raise_With_Msg, "__gnat_raise_with_msg");
305 -- Raises an exception with given exception id value. A message
306 -- is associated with the raise, and has already been stored in the
307 -- exception occurrence referenced by the Current_Excep in the TSD.
308 -- Abort is deferred before the raise call.
310 procedure Raise_With_Location_And_Msg
315 M : System.Address := System.Null_Address);
316 pragma No_Return (Raise_With_Location_And_Msg);
317 -- Raise an exception with given exception id value. A filename and line
318 -- number is associated with the raise and is stored in the exception
319 -- occurrence and in addition a column and a string message M may be
320 -- appended to this (if not null/0).
322 procedure Raise_Constraint_Error
323 (File : System.Address;
325 pragma No_Return (Raise_Constraint_Error);
327 (C, Raise_Constraint_Error, "__gnat_raise_constraint_error");
328 -- Raise constraint error with file:line information
330 procedure Raise_Constraint_Error_Msg
331 (File : System.Address;
334 Msg : System.Address);
335 pragma No_Return (Raise_Constraint_Error_Msg);
337 (C, Raise_Constraint_Error_Msg, "__gnat_raise_constraint_error_msg");
338 -- Raise constraint error with file:line:col + msg information
340 procedure Raise_Program_Error
341 (File : System.Address;
343 pragma No_Return (Raise_Program_Error);
345 (C, Raise_Program_Error, "__gnat_raise_program_error");
346 -- Raise program error with file:line information
348 procedure Raise_Program_Error_Msg
349 (File : System.Address;
351 Msg : System.Address);
352 pragma No_Return (Raise_Program_Error_Msg);
354 (C, Raise_Program_Error_Msg, "__gnat_raise_program_error_msg");
355 -- Raise program error with file:line + msg information
357 procedure Raise_Storage_Error
358 (File : System.Address;
360 pragma No_Return (Raise_Storage_Error);
362 (C, Raise_Storage_Error, "__gnat_raise_storage_error");
363 -- Raise storage error with file:line information
365 procedure Raise_Storage_Error_Msg
366 (File : System.Address;
368 Msg : System.Address);
369 pragma No_Return (Raise_Storage_Error_Msg);
371 (C, Raise_Storage_Error_Msg, "__gnat_raise_storage_error_msg");
372 -- Raise storage error with file:line + reason msg information
374 -- The exception raising process and the automatic tracing mechanism rely
375 -- on some careful use of flags attached to the exception occurrence. The
376 -- graph below illustrates the relations between the Raise_ subprograms
377 -- and identifies the points where basic flags such as Exception_Raised
380 -- (i) signs indicate the flags initialization points. R stands for Raise,
381 -- W for With, and E for Exception.
383 -- R_No_Msg R_E R_Pe R_Ce R_Se
385 -- +--+ +--+ +---+ | +---+
387 -- R_E_No_Defer(i) R_W_Msg(i) R_W_Loc
389 -- +------------+ | +-----------+ +--+
391 -- | | | Set_E_C_Msg(i)
393 -- Raise_Current_Excep
396 pragma No_Return (Reraise);
397 pragma Export (C, Reraise, "__gnat_reraise");
398 -- Reraises the exception referenced by the Current_Excep field of
399 -- the TSD (all fields of this exception occurrence are set). Abort
400 -- is deferred before the reraise operation.
402 -- Save_Occurrence variations: As the management of the private data
403 -- attached to occurrences is delicate, whether or not pointers to such
404 -- data has to be copied in various situations is better made explicit.
405 -- The following procedures provide an internal interface to help making
408 procedure Save_Occurrence_No_Private
409 (Target : out Exception_Occurrence;
410 Source : Exception_Occurrence);
411 -- Copy all the components of Source to Target, except the
412 -- Private_Data pointer.
414 procedure Transfer_Occurrence
415 (Target : Exception_Occurrence_Access;
416 Source : Exception_Occurrence);
417 pragma Export (C, Transfer_Occurrence, "__gnat_transfer_occurrence");
418 -- Called from System.Tasking.RendezVous.Exceptional_Complete_RendezVous
419 -- to setup Target from Source as an exception to be propagated in the
420 -- caller task. Target is expected to be a pointer to the fixed TSD
421 -- occurrence for this task.
423 -----------------------------
424 -- Run-Time Check Routines --
425 -----------------------------
427 -- These routines raise a specific exception with a reason message
428 -- attached. The parameters are the file name and line number in each
429 -- case. The names are keyed to the codes defined in types.ads and
430 -- a-types.h (for example, the name Rcheck_05 refers to the Reason
431 -- RT_Exception_Code'Val (5)).
433 procedure Rcheck_00 (File : System.Address; Line : Integer);
434 procedure Rcheck_01 (File : System.Address; Line : Integer);
435 procedure Rcheck_02 (File : System.Address; Line : Integer);
436 procedure Rcheck_03 (File : System.Address; Line : Integer);
437 procedure Rcheck_04 (File : System.Address; Line : Integer);
438 procedure Rcheck_05 (File : System.Address; Line : Integer);
439 procedure Rcheck_06 (File : System.Address; Line : Integer);
440 procedure Rcheck_07 (File : System.Address; Line : Integer);
441 procedure Rcheck_08 (File : System.Address; Line : Integer);
442 procedure Rcheck_09 (File : System.Address; Line : Integer);
443 procedure Rcheck_10 (File : System.Address; Line : Integer);
444 procedure Rcheck_11 (File : System.Address; Line : Integer);
445 procedure Rcheck_12 (File : System.Address; Line : Integer);
446 procedure Rcheck_13 (File : System.Address; Line : Integer);
447 procedure Rcheck_14 (File : System.Address; Line : Integer);
448 procedure Rcheck_15 (File : System.Address; Line : Integer);
449 procedure Rcheck_16 (File : System.Address; Line : Integer);
450 procedure Rcheck_17 (File : System.Address; Line : Integer);
451 procedure Rcheck_18 (File : System.Address; Line : Integer);
452 procedure Rcheck_19 (File : System.Address; Line : Integer);
453 procedure Rcheck_20 (File : System.Address; Line : Integer);
454 procedure Rcheck_21 (File : System.Address; Line : Integer);
455 procedure Rcheck_22 (File : System.Address; Line : Integer);
456 procedure Rcheck_23 (File : System.Address; Line : Integer);
457 procedure Rcheck_24 (File : System.Address; Line : Integer);
458 procedure Rcheck_25 (File : System.Address; Line : Integer);
459 procedure Rcheck_26 (File : System.Address; Line : Integer);
460 procedure Rcheck_27 (File : System.Address; Line : Integer);
461 procedure Rcheck_28 (File : System.Address; Line : Integer);
462 procedure Rcheck_29 (File : System.Address; Line : Integer);
463 procedure Rcheck_30 (File : System.Address; Line : Integer);
464 procedure Rcheck_31 (File : System.Address; Line : Integer);
465 procedure Rcheck_32 (File : System.Address; Line : Integer);
466 procedure Rcheck_33 (File : System.Address; Line : Integer);
467 procedure Rcheck_34 (File : System.Address; Line : Integer);
469 procedure Rcheck_00_Ext
470 (File : System.Address; Line, Column : Integer);
471 procedure Rcheck_05_Ext
472 (File : System.Address; Line, Column, Index, First, Last : Integer);
473 procedure Rcheck_06_Ext
474 (File : System.Address; Line, Column, Index, First, Last : Integer);
475 procedure Rcheck_12_Ext
476 (File : System.Address; Line, Column, Index, First, Last : Integer);
478 pragma Export (C, Rcheck_00, "__gnat_rcheck_00");
479 pragma Export (C, Rcheck_01, "__gnat_rcheck_01");
480 pragma Export (C, Rcheck_02, "__gnat_rcheck_02");
481 pragma Export (C, Rcheck_03, "__gnat_rcheck_03");
482 pragma Export (C, Rcheck_04, "__gnat_rcheck_04");
483 pragma Export (C, Rcheck_05, "__gnat_rcheck_05");
484 pragma Export (C, Rcheck_06, "__gnat_rcheck_06");
485 pragma Export (C, Rcheck_07, "__gnat_rcheck_07");
486 pragma Export (C, Rcheck_08, "__gnat_rcheck_08");
487 pragma Export (C, Rcheck_09, "__gnat_rcheck_09");
488 pragma Export (C, Rcheck_10, "__gnat_rcheck_10");
489 pragma Export (C, Rcheck_11, "__gnat_rcheck_11");
490 pragma Export (C, Rcheck_12, "__gnat_rcheck_12");
491 pragma Export (C, Rcheck_13, "__gnat_rcheck_13");
492 pragma Export (C, Rcheck_14, "__gnat_rcheck_14");
493 pragma Export (C, Rcheck_15, "__gnat_rcheck_15");
494 pragma Export (C, Rcheck_16, "__gnat_rcheck_16");
495 pragma Export (C, Rcheck_17, "__gnat_rcheck_17");
496 pragma Export (C, Rcheck_18, "__gnat_rcheck_18");
497 pragma Export (C, Rcheck_19, "__gnat_rcheck_19");
498 pragma Export (C, Rcheck_20, "__gnat_rcheck_20");
499 pragma Export (C, Rcheck_21, "__gnat_rcheck_21");
500 pragma Export (C, Rcheck_22, "__gnat_rcheck_22");
501 pragma Export (C, Rcheck_23, "__gnat_rcheck_23");
502 pragma Export (C, Rcheck_24, "__gnat_rcheck_24");
503 pragma Export (C, Rcheck_25, "__gnat_rcheck_25");
504 pragma Export (C, Rcheck_26, "__gnat_rcheck_26");
505 pragma Export (C, Rcheck_27, "__gnat_rcheck_27");
506 pragma Export (C, Rcheck_28, "__gnat_rcheck_28");
507 pragma Export (C, Rcheck_29, "__gnat_rcheck_29");
508 pragma Export (C, Rcheck_30, "__gnat_rcheck_30");
509 pragma Export (C, Rcheck_31, "__gnat_rcheck_31");
510 pragma Export (C, Rcheck_32, "__gnat_rcheck_32");
511 pragma Export (C, Rcheck_33, "__gnat_rcheck_33");
512 pragma Export (C, Rcheck_34, "__gnat_rcheck_34");
514 pragma Export (C, Rcheck_00_Ext, "__gnat_rcheck_00_ext");
515 pragma Export (C, Rcheck_05_Ext, "__gnat_rcheck_05_ext");
516 pragma Export (C, Rcheck_06_Ext, "__gnat_rcheck_06_ext");
517 pragma Export (C, Rcheck_12_Ext, "__gnat_rcheck_12_ext");
519 -- None of these procedures ever returns (they raise an exception!). By
520 -- using pragma No_Return, we ensure that any junk code after the call,
521 -- such as normal return epilog stuff, can be eliminated).
523 pragma No_Return (Rcheck_00);
524 pragma No_Return (Rcheck_01);
525 pragma No_Return (Rcheck_02);
526 pragma No_Return (Rcheck_03);
527 pragma No_Return (Rcheck_04);
528 pragma No_Return (Rcheck_05);
529 pragma No_Return (Rcheck_06);
530 pragma No_Return (Rcheck_07);
531 pragma No_Return (Rcheck_08);
532 pragma No_Return (Rcheck_09);
533 pragma No_Return (Rcheck_10);
534 pragma No_Return (Rcheck_11);
535 pragma No_Return (Rcheck_12);
536 pragma No_Return (Rcheck_13);
537 pragma No_Return (Rcheck_14);
538 pragma No_Return (Rcheck_15);
539 pragma No_Return (Rcheck_16);
540 pragma No_Return (Rcheck_17);
541 pragma No_Return (Rcheck_18);
542 pragma No_Return (Rcheck_19);
543 pragma No_Return (Rcheck_20);
544 pragma No_Return (Rcheck_21);
545 pragma No_Return (Rcheck_22);
546 pragma No_Return (Rcheck_23);
547 pragma No_Return (Rcheck_24);
548 pragma No_Return (Rcheck_25);
549 pragma No_Return (Rcheck_26);
550 pragma No_Return (Rcheck_27);
551 pragma No_Return (Rcheck_28);
552 pragma No_Return (Rcheck_29);
553 pragma No_Return (Rcheck_30);
554 pragma No_Return (Rcheck_32);
555 pragma No_Return (Rcheck_33);
556 pragma No_Return (Rcheck_34);
558 pragma No_Return (Rcheck_00_Ext);
559 pragma No_Return (Rcheck_05_Ext);
560 pragma No_Return (Rcheck_06_Ext);
561 pragma No_Return (Rcheck_12_Ext);
563 ---------------------------------------------
564 -- Reason Strings for Run-Time Check Calls --
565 ---------------------------------------------
567 -- These strings are null-terminated and are used by Rcheck_nn. The
568 -- strings correspond to the definitions for Types.RT_Exception_Code.
572 Rmsg_00 : constant String := "access check failed" & NUL;
573 Rmsg_01 : constant String := "access parameter is null" & NUL;
574 Rmsg_02 : constant String := "discriminant check failed" & NUL;
575 Rmsg_03 : constant String := "divide by zero" & NUL;
576 Rmsg_04 : constant String := "explicit raise" & NUL;
577 Rmsg_05 : constant String := "index check failed" & NUL;
578 Rmsg_06 : constant String := "invalid data" & NUL;
579 Rmsg_07 : constant String := "length check failed" & NUL;
580 Rmsg_08 : constant String := "null Exception_Id" & NUL;
581 Rmsg_09 : constant String := "null-exclusion check failed" & NUL;
582 Rmsg_10 : constant String := "overflow check failed" & NUL;
583 Rmsg_11 : constant String := "partition check failed" & NUL;
584 Rmsg_12 : constant String := "range check failed" & NUL;
585 Rmsg_13 : constant String := "tag check failed" & NUL;
586 Rmsg_14 : constant String := "access before elaboration" & NUL;
587 Rmsg_15 : constant String := "accessibility check failed" & NUL;
588 Rmsg_16 : constant String := "attempt to take address of" &
589 " intrinsic subprogram" & NUL;
590 Rmsg_17 : constant String := "all guards closed" & NUL;
591 Rmsg_18 : constant String := "improper use of generic subtype" &
592 " with predicate" & NUL;
593 Rmsg_19 : constant String := "Current_Task referenced in entry" &
595 Rmsg_20 : constant String := "duplicated entry address" & NUL;
596 Rmsg_21 : constant String := "explicit raise" & NUL;
597 Rmsg_22 : constant String := "finalize/adjust raised exception" & NUL;
598 Rmsg_23 : constant String := "implicit return with No_Return" & NUL;
599 Rmsg_24 : constant String := "misaligned address value" & NUL;
600 Rmsg_25 : constant String := "missing return" & NUL;
601 Rmsg_26 : constant String := "overlaid controlled object" & NUL;
602 Rmsg_27 : constant String := "potentially blocking operation" & NUL;
603 Rmsg_28 : constant String := "stubbed subprogram called" & NUL;
604 Rmsg_29 : constant String := "unchecked union restriction" & NUL;
605 Rmsg_30 : constant String := "actual/returned class-wide" &
606 " value not transportable" & NUL;
607 Rmsg_31 : constant String := "empty storage pool" & NUL;
608 Rmsg_32 : constant String := "explicit raise" & NUL;
609 Rmsg_33 : constant String := "infinite recursion" & NUL;
610 Rmsg_34 : constant String := "object too large" & NUL;
612 -----------------------
613 -- Polling Interface --
614 -----------------------
616 type Unsigned is mod 2 ** 32;
618 Counter : Unsigned := 0;
619 pragma Warnings (Off, Counter);
620 -- This counter is provided for convenience. It can be used in Poll to
621 -- perform periodic but not systematic operations.
623 procedure Poll is separate;
624 -- The actual polling routine is separate, so that it can easily
625 -- be replaced with a target dependent version.
627 --------------------------
628 -- Code_Address_For_AAA --
629 --------------------------
631 -- This function gives us the start of the PC range for addresses
632 -- within the exception unit itself. We hope that gigi/gcc keep all the
633 -- procedures in their original order!
635 function Code_Address_For_AAA return System.Address is
637 -- We are using a label instead of merely using
638 -- Code_Address_For_AAA'Address because on some platforms the latter
639 -- does not yield the address we want, but the address of a stub or of
640 -- a descriptor instead. This is the case at least on Alpha-VMS and
644 return Start_Of_AAA'Address;
645 end Code_Address_For_AAA;
651 procedure Call_Chain (Excep : EOA) is separate;
652 -- The actual Call_Chain routine is separate, so that it can easily
653 -- be dummied out when no exception traceback information is needed.
655 ------------------------------
656 -- Current_Target_Exception --
657 ------------------------------
659 function Current_Target_Exception return Exception_Occurrence is
661 return Null_Occurrence;
662 end Current_Target_Exception;
668 function EId_To_String (X : Exception_Id) return String
669 renames Stream_Attributes.EId_To_String;
675 -- We use the null string to represent the null occurrence, otherwise
676 -- we output the Exception_Information string for the occurrence.
678 function EO_To_String (X : Exception_Occurrence) return String
679 renames Stream_Attributes.EO_To_String;
681 ------------------------
682 -- Exception_Identity --
683 ------------------------
685 function Exception_Identity
686 (X : Exception_Occurrence) return Exception_Id
689 -- Note that the following test used to be here for the original
690 -- Ada 95 semantics, but these were modified by AI-241 to require
691 -- returning Null_Id instead of raising Constraint_Error.
693 -- if X.Id = Null_Id then
694 -- raise Constraint_Error;
698 end Exception_Identity;
700 ---------------------------
701 -- Exception_Information --
702 ---------------------------
704 function Exception_Information (X : Exception_Occurrence) return String is
706 if X.Id = Null_Id then
707 raise Constraint_Error;
710 return Exception_Data.Exception_Information (X);
711 end Exception_Information;
713 -----------------------
714 -- Exception_Message --
715 -----------------------
717 function Exception_Message (X : Exception_Occurrence) return String is
719 if X.Id = Null_Id then
720 raise Constraint_Error;
723 return X.Msg (1 .. X.Msg_Length);
724 end Exception_Message;
730 function Exception_Name (Id : Exception_Id) return String is
733 raise Constraint_Error;
736 return To_Ptr (Id.Full_Name) (1 .. Id.Name_Length - 1);
739 function Exception_Name (X : Exception_Occurrence) return String is
741 return Exception_Name (X.Id);
744 ---------------------------
745 -- Exception_Name_Simple --
746 ---------------------------
748 function Exception_Name_Simple (X : Exception_Occurrence) return String is
749 Name : constant String := Exception_Name (X);
755 exit when Name (P - 1) = '.';
759 -- Return result making sure lower bound is 1
762 subtype Rname is String (1 .. Name'Length - P + 1);
764 return Rname (Name (P .. Name'Length));
766 end Exception_Name_Simple;
772 package body Exception_Data is separate;
773 -- This package can be easily dummied out if we do not want the
774 -- basic support for exception messages (such as in Ada 83).
776 ---------------------------
777 -- Exception_Propagation --
778 ---------------------------
780 package body Exception_Propagation is separate;
781 -- Depending on the actual exception mechanism used (front-end or
782 -- back-end based), the implementation will differ, which is why this
783 -- package is separated.
785 ----------------------
786 -- Exception_Traces --
787 ----------------------
789 package body Exception_Traces is separate;
790 -- Depending on the underlying support for IO the implementation
791 -- will differ. Moreover we would like to dummy out this package
792 -- in case we do not want any exception tracing support. This is
793 -- why this package is separated.
795 -----------------------
796 -- Stream Attributes --
797 -----------------------
799 package body Stream_Attributes is separate;
800 -- This package can be easily dummied out if we do not want the
801 -- support for streaming Exception_Ids and Exception_Occurrences.
803 ----------------------------
804 -- Raise_Constraint_Error --
805 ----------------------------
807 procedure Raise_Constraint_Error (File : System.Address; Line : Integer) is
809 Raise_With_Location_And_Msg (Constraint_Error_Def'Access, File, Line);
810 end Raise_Constraint_Error;
812 --------------------------------
813 -- Raise_Constraint_Error_Msg --
814 --------------------------------
816 procedure Raise_Constraint_Error_Msg
817 (File : System.Address;
820 Msg : System.Address)
823 Raise_With_Location_And_Msg
824 (Constraint_Error_Def'Access, File, Line, Column, Msg);
825 end Raise_Constraint_Error_Msg;
827 -------------------------
828 -- Raise_Current_Excep --
829 -------------------------
831 procedure Raise_Current_Excep (E : Exception_Id) is
833 Debug_Raise_Exception (E => SSL.Exception_Data_Ptr (E));
834 Exception_Propagation.Propagate_Exception
835 (E => E, From_Signal_Handler => False);
836 end Raise_Current_Excep;
838 ---------------------
839 -- Raise_Exception --
840 ---------------------
842 procedure Raise_Exception
844 Message : String := "")
846 EF : Exception_Id := E;
849 -- Raise CE if E = Null_ID (AI-446)
852 EF := Constraint_Error'Identity;
855 -- Go ahead and raise appropriate exception
857 Exception_Data.Set_Exception_Msg (EF, Message);
859 Raise_Current_Excep (EF);
862 ----------------------------
863 -- Raise_Exception_Always --
864 ----------------------------
866 procedure Raise_Exception_Always
868 Message : String := "")
871 Exception_Data.Set_Exception_Msg (E, Message);
873 Raise_Current_Excep (E);
874 end Raise_Exception_Always;
876 -------------------------------------
877 -- Raise_From_Controlled_Operation --
878 -------------------------------------
880 procedure Raise_From_Controlled_Operation
881 (X : Ada.Exceptions.Exception_Occurrence)
883 Prev_Exc : constant EOA := Get_Current_Excep.all;
886 -- We're raising an exception during finalization. If the finalization
887 -- was triggered by an abort, as indicated by Not_Handled_By_Others,
888 -- then we don't want to raise Program_Error; we want to continue with
889 -- the Abort_Signal exception. Note that the original exception
890 -- occurrence that triggered the finalization is saved before calling
891 -- the Finalize procedures, and then restored afterward, so in the case
892 -- of abort, the original Abort_Signal will be the current one.
894 if Prev_Exc.Id /= null and then Prev_Exc.Id.Not_Handled_By_Others then
895 Raise_Current_Excep (Prev_Exc.Id);
897 -- Otherwise, raise Program_Error
901 Prefix : constant String := "adjust/finalize raised ";
902 Orig_Msg : constant String := Exception_Message (X);
903 Orig_Prefix_Length : constant Natural :=
904 Integer'Min (Prefix'Length, Orig_Msg'Length);
905 Orig_Prefix : String renames Orig_Msg
906 (Orig_Msg'First .. Orig_Msg'First + Orig_Prefix_Length - 1);
909 -- Message already has the proper prefix, just re-reraise
911 if Orig_Prefix = Prefix then
912 Raise_Exception_No_Defer
913 (E => Program_Error'Identity,
914 Message => Orig_Msg);
918 New_Msg : constant String := Prefix & Exception_Name (X);
921 -- No message present, just provide our own
923 if Orig_Msg = "" then
924 Raise_Exception_No_Defer
925 (E => Program_Error'Identity,
928 -- Message present, add informational prefix
931 Raise_Exception_No_Defer
932 (E => Program_Error'Identity,
933 Message => New_Msg & ": " & Orig_Msg);
939 end Raise_From_Controlled_Operation;
941 -------------------------------
942 -- Raise_From_Signal_Handler --
943 -------------------------------
945 procedure Raise_From_Signal_Handler
950 Exception_Data.Set_Exception_C_Msg (E, M);
952 Debug_Raise_Exception (E => SSL.Exception_Data_Ptr (E));
953 Exception_Propagation.Propagate_Exception
954 (E => E, From_Signal_Handler => True);
955 end Raise_From_Signal_Handler;
957 -------------------------
958 -- Raise_Program_Error --
959 -------------------------
961 procedure Raise_Program_Error
962 (File : System.Address;
966 Raise_With_Location_And_Msg (Program_Error_Def'Access, File, Line);
967 end Raise_Program_Error;
969 -----------------------------
970 -- Raise_Program_Error_Msg --
971 -----------------------------
973 procedure Raise_Program_Error_Msg
974 (File : System.Address;
976 Msg : System.Address)
979 Raise_With_Location_And_Msg
980 (Program_Error_Def'Access, File, Line, M => Msg);
981 end Raise_Program_Error_Msg;
983 -------------------------
984 -- Raise_Storage_Error --
985 -------------------------
987 procedure Raise_Storage_Error
988 (File : System.Address;
992 Raise_With_Location_And_Msg (Storage_Error_Def'Access, File, Line);
993 end Raise_Storage_Error;
995 -----------------------------
996 -- Raise_Storage_Error_Msg --
997 -----------------------------
999 procedure Raise_Storage_Error_Msg
1000 (File : System.Address;
1002 Msg : System.Address)
1005 Raise_With_Location_And_Msg
1006 (Storage_Error_Def'Access, File, Line, M => Msg);
1007 end Raise_Storage_Error_Msg;
1009 ---------------------------------
1010 -- Raise_With_Location_And_Msg --
1011 ---------------------------------
1013 procedure Raise_With_Location_And_Msg
1018 M : System.Address := System.Null_Address)
1021 Exception_Data.Set_Exception_C_Msg (E, F, L, C, M);
1023 Raise_Current_Excep (E);
1024 end Raise_With_Location_And_Msg;
1026 --------------------
1027 -- Raise_With_Msg --
1028 --------------------
1030 procedure Raise_With_Msg (E : Exception_Id) is
1031 Excep : constant EOA := Get_Current_Excep.all;
1034 Exception_Propagation.Setup_Exception (Excep, Excep);
1036 Excep.Exception_Raised := False;
1038 Excep.Num_Tracebacks := 0;
1039 Excep.Cleanup_Flag := False;
1040 Excep.Pid := Local_Partition_ID;
1042 Raise_Current_Excep (E);
1049 function Image (Index : Integer) return String is
1050 Result : constant String := Integer'Image (Index);
1052 if Result (1) = ' ' then
1053 return Result (2 .. Result'Last);
1059 --------------------------------------
1060 -- Calls to Run-Time Check Routines --
1061 --------------------------------------
1063 procedure Rcheck_00 (File : System.Address; Line : Integer) is
1065 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_00'Address);
1068 procedure Rcheck_01 (File : System.Address; Line : Integer) is
1070 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_01'Address);
1073 procedure Rcheck_02 (File : System.Address; Line : Integer) is
1075 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_02'Address);
1078 procedure Rcheck_03 (File : System.Address; Line : Integer) is
1080 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_03'Address);
1083 procedure Rcheck_04 (File : System.Address; Line : Integer) is
1085 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_04'Address);
1088 procedure Rcheck_05 (File : System.Address; Line : Integer) is
1090 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_05'Address);
1093 procedure Rcheck_06 (File : System.Address; Line : Integer) is
1095 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_06'Address);
1098 procedure Rcheck_07 (File : System.Address; Line : Integer) is
1100 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_07'Address);
1103 procedure Rcheck_08 (File : System.Address; Line : Integer) is
1105 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_08'Address);
1108 procedure Rcheck_09 (File : System.Address; Line : Integer) is
1110 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_09'Address);
1113 procedure Rcheck_10 (File : System.Address; Line : Integer) is
1115 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_10'Address);
1118 procedure Rcheck_11 (File : System.Address; Line : Integer) is
1120 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_11'Address);
1123 procedure Rcheck_12 (File : System.Address; Line : Integer) is
1125 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_12'Address);
1128 procedure Rcheck_13 (File : System.Address; Line : Integer) is
1130 Raise_Constraint_Error_Msg (File, Line, 0, Rmsg_13'Address);
1133 procedure Rcheck_14 (File : System.Address; Line : Integer) is
1135 Raise_Program_Error_Msg (File, Line, Rmsg_14'Address);
1138 procedure Rcheck_15 (File : System.Address; Line : Integer) is
1140 Raise_Program_Error_Msg (File, Line, Rmsg_15'Address);
1143 procedure Rcheck_16 (File : System.Address; Line : Integer) is
1145 Raise_Program_Error_Msg (File, Line, Rmsg_16'Address);
1148 procedure Rcheck_17 (File : System.Address; Line : Integer) is
1150 Raise_Program_Error_Msg (File, Line, Rmsg_17'Address);
1153 procedure Rcheck_18 (File : System.Address; Line : Integer) is
1155 Raise_Program_Error_Msg (File, Line, Rmsg_18'Address);
1158 procedure Rcheck_19 (File : System.Address; Line : Integer) is
1160 Raise_Program_Error_Msg (File, Line, Rmsg_19'Address);
1163 procedure Rcheck_20 (File : System.Address; Line : Integer) is
1165 Raise_Program_Error_Msg (File, Line, Rmsg_20'Address);
1168 procedure Rcheck_21 (File : System.Address; Line : Integer) is
1170 Raise_Program_Error_Msg (File, Line, Rmsg_21'Address);
1173 procedure Rcheck_22 (File : System.Address; Line : Integer) is
1175 Raise_Program_Error_Msg (File, Line, Rmsg_22'Address);
1178 procedure Rcheck_23 (File : System.Address; Line : Integer) is
1180 Raise_Program_Error_Msg (File, Line, Rmsg_23'Address);
1183 procedure Rcheck_24 (File : System.Address; Line : Integer) is
1185 Raise_Program_Error_Msg (File, Line, Rmsg_24'Address);
1188 procedure Rcheck_25 (File : System.Address; Line : Integer) is
1190 Raise_Program_Error_Msg (File, Line, Rmsg_25'Address);
1193 procedure Rcheck_26 (File : System.Address; Line : Integer) is
1195 Raise_Program_Error_Msg (File, Line, Rmsg_26'Address);
1198 procedure Rcheck_27 (File : System.Address; Line : Integer) is
1200 Raise_Program_Error_Msg (File, Line, Rmsg_27'Address);
1203 procedure Rcheck_28 (File : System.Address; Line : Integer) is
1205 Raise_Program_Error_Msg (File, Line, Rmsg_28'Address);
1208 procedure Rcheck_29 (File : System.Address; Line : Integer) is
1210 Raise_Program_Error_Msg (File, Line, Rmsg_29'Address);
1213 procedure Rcheck_30 (File : System.Address; Line : Integer) is
1215 Raise_Program_Error_Msg (File, Line, Rmsg_30'Address);
1218 procedure Rcheck_31 (File : System.Address; Line : Integer) is
1220 Raise_Storage_Error_Msg (File, Line, Rmsg_31'Address);
1223 procedure Rcheck_32 (File : System.Address; Line : Integer) is
1225 Raise_Storage_Error_Msg (File, Line, Rmsg_32'Address);
1228 procedure Rcheck_33 (File : System.Address; Line : Integer) is
1230 Raise_Storage_Error_Msg (File, Line, Rmsg_33'Address);
1233 procedure Rcheck_34 (File : System.Address; Line : Integer) is
1235 Raise_Storage_Error_Msg (File, Line, Rmsg_34'Address);
1238 procedure Rcheck_00_Ext (File : System.Address; Line, Column : Integer) is
1240 Raise_Constraint_Error_Msg (File, Line, Column, Rmsg_00'Address);
1243 procedure Rcheck_05_Ext
1244 (File : System.Address; Line, Column, Index, First, Last : Integer)
1246 Msg : constant String :=
1247 Rmsg_05 (Rmsg_05'First .. Rmsg_05'Last - 1) & ASCII.LF &
1248 "index " & Image (Index) & " not in " & Image (First) &
1249 ".." & Image (Last) & ASCII.NUL;
1251 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
1254 procedure Rcheck_06_Ext
1255 (File : System.Address; Line, Column, Index, First, Last : Integer)
1257 Msg : constant String :=
1258 Rmsg_06 (Rmsg_06'First .. Rmsg_06'Last - 1) & ASCII.LF &
1259 "value " & Image (Index) & " not in " & Image (First) &
1260 ".." & Image (Last) & ASCII.NUL;
1262 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
1265 procedure Rcheck_12_Ext
1266 (File : System.Address; Line, Column, Index, First, Last : Integer)
1268 Msg : constant String :=
1269 Rmsg_12 (Rmsg_12'First .. Rmsg_12'Last - 1) & ASCII.LF &
1270 "value " & Image (Index) & " not in " & Image (First) &
1271 ".." & Image (Last) & ASCII.NUL;
1273 Raise_Constraint_Error_Msg (File, Line, Column, Msg'Address);
1280 procedure Reraise is
1281 Excep : constant EOA := Get_Current_Excep.all;
1284 Exception_Propagation.Setup_Exception (Excep, Excep, Reraised => True);
1285 Raise_Current_Excep (Excep.Id);
1288 ------------------------
1289 -- Reraise_Occurrence --
1290 ------------------------
1292 procedure Reraise_Occurrence (X : Exception_Occurrence) is
1294 if X.Id /= null then
1296 Exception_Propagation.Setup_Exception
1297 (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
1298 Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
1299 Raise_Current_Excep (X.Id);
1301 end Reraise_Occurrence;
1303 -------------------------------
1304 -- Reraise_Occurrence_Always --
1305 -------------------------------
1307 procedure Reraise_Occurrence_Always (X : Exception_Occurrence) is
1310 Exception_Propagation.Setup_Exception
1311 (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
1312 Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
1313 Raise_Current_Excep (X.Id);
1314 end Reraise_Occurrence_Always;
1316 ---------------------------------
1317 -- Reraise_Occurrence_No_Defer --
1318 ---------------------------------
1320 procedure Reraise_Occurrence_No_Defer (X : Exception_Occurrence) is
1322 Exception_Propagation.Setup_Exception
1323 (X'Unrestricted_Access, Get_Current_Excep.all, Reraised => True);
1324 Save_Occurrence_No_Private (Get_Current_Excep.all.all, X);
1325 Raise_Current_Excep (X.Id);
1326 end Reraise_Occurrence_No_Defer;
1328 ---------------------
1329 -- Save_Occurrence --
1330 ---------------------
1332 procedure Save_Occurrence
1333 (Target : out Exception_Occurrence;
1334 Source : Exception_Occurrence)
1337 Save_Occurrence_No_Private (Target, Source);
1338 end Save_Occurrence;
1340 function Save_Occurrence (Source : Exception_Occurrence) return EOA is
1341 Target : constant EOA := new Exception_Occurrence;
1343 Save_Occurrence (Target.all, Source);
1345 end Save_Occurrence;
1347 --------------------------------
1348 -- Save_Occurrence_No_Private --
1349 --------------------------------
1351 procedure Save_Occurrence_No_Private
1352 (Target : out Exception_Occurrence;
1353 Source : Exception_Occurrence)
1356 Target.Id := Source.Id;
1357 Target.Msg_Length := Source.Msg_Length;
1358 Target.Num_Tracebacks := Source.Num_Tracebacks;
1359 Target.Pid := Source.Pid;
1360 Target.Cleanup_Flag := Source.Cleanup_Flag;
1362 Target.Msg (1 .. Target.Msg_Length) :=
1363 Source.Msg (1 .. Target.Msg_Length);
1365 Target.Tracebacks (1 .. Target.Num_Tracebacks) :=
1366 Source.Tracebacks (1 .. Target.Num_Tracebacks);
1367 end Save_Occurrence_No_Private;
1369 -------------------------
1370 -- Transfer_Occurrence --
1371 -------------------------
1373 procedure Transfer_Occurrence
1374 (Target : Exception_Occurrence_Access;
1375 Source : Exception_Occurrence)
1378 -- Setup Target as an exception to be propagated in the calling task
1379 -- (rendezvous-wise), taking care not to clobber the associated private
1380 -- data. Target is expected to be a pointer to the calling task's
1381 -- fixed TSD occurrence, which is very different from Get_Current_Excep
1382 -- here because this subprogram is called from the called task.
1384 Exception_Propagation.Setup_Exception (Target, Target);
1385 Save_Occurrence_No_Private (Target.all, Source);
1386 end Transfer_Occurrence;
1392 function String_To_EId (S : String) return Exception_Id
1393 renames Stream_Attributes.String_To_EId;
1399 function String_To_EO (S : String) return Exception_Occurrence
1400 renames Stream_Attributes.String_To_EO;
1402 ------------------------------
1403 -- Raise_Exception_No_Defer --
1404 ------------------------------
1406 procedure Raise_Exception_No_Defer
1408 Message : String := "")
1411 Exception_Data.Set_Exception_Msg (E, Message);
1413 -- Do not call Abort_Defer.all, as specified by the spec
1415 Raise_Current_Excep (E);
1416 end Raise_Exception_No_Defer;
1422 procedure To_Stderr (C : Character) is
1423 type int is new Integer;
1425 procedure put_char_stderr (C : int);
1426 pragma Import (C, put_char_stderr, "put_char_stderr");
1429 put_char_stderr (Character'Pos (C));
1432 procedure To_Stderr (S : String) is
1434 for J in S'Range loop
1435 if S (J) /= ASCII.CR then
1441 -------------------------
1442 -- Wide_Exception_Name --
1443 -------------------------
1445 WC_Encoding : Character;
1446 pragma Import (C, WC_Encoding, "__gl_wc_encoding");
1447 -- Encoding method for source, as exported by binder
1449 function Wide_Exception_Name
1450 (Id : Exception_Id) return Wide_String
1452 S : constant String := Exception_Name (Id);
1453 W : Wide_String (1 .. S'Length);
1456 String_To_Wide_String
1457 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
1459 end Wide_Exception_Name;
1461 function Wide_Exception_Name
1462 (X : Exception_Occurrence) return Wide_String
1464 S : constant String := Exception_Name (X);
1465 W : Wide_String (1 .. S'Length);
1468 String_To_Wide_String
1469 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
1471 end Wide_Exception_Name;
1473 ----------------------------
1474 -- Wide_Wide_Exception_Name --
1475 -----------------------------
1477 function Wide_Wide_Exception_Name
1478 (Id : Exception_Id) return Wide_Wide_String
1480 S : constant String := Exception_Name (Id);
1481 W : Wide_Wide_String (1 .. S'Length);
1484 String_To_Wide_Wide_String
1485 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
1487 end Wide_Wide_Exception_Name;
1489 function Wide_Wide_Exception_Name
1490 (X : Exception_Occurrence) return Wide_Wide_String
1492 S : constant String := Exception_Name (X);
1493 W : Wide_Wide_String (1 .. S'Length);
1496 String_To_Wide_Wide_String
1497 (S, W, L, Get_WC_Encoding_Method (WC_Encoding));
1499 end Wide_Wide_Exception_Name;
1501 --------------------------
1502 -- Code_Address_For_ZZZ --
1503 --------------------------
1505 -- This function gives us the end of the PC range for addresses
1506 -- within the exception unit itself. We hope that gigi/gcc keeps all the
1507 -- procedures in their original order!
1509 function Code_Address_For_ZZZ return System.Address is
1512 return Start_Of_ZZZ'Address;
1513 end Code_Address_For_ZZZ;