-- 0xyyyyyyyy 0xyyyyyyyy ...
--
-- The lines are separated by a ASCII.LF character
- -- The nnnn is the partition Id given as decimal digits.
+ --
+ -- The nnnn is the partition Id given as decimal digits
+ --
-- The 0x... line represents traceback program counter locations,
-- in order with the first one being the exception location.
pragma Export
(Ada, Current_Target_Exception,
"__gnat_current_target_exception");
- -- This routine should return the current raised exception on targets
- -- which have built-in exception handling such as the Java Virtual
- -- Machine. For other targets this routine is simply ignored. Currently,
- -- only JGNAT uses this. See 4jexcept.ads for details. The pragma Export
- -- allows this routine to be accessed elsewhere in the run-time, even
- -- though it is in the private part of this package (it is not allowed
- -- to be in the visible part, since this is set by the reference manual).
+ -- This routine should return the current raised exception on targets which
+ -- have built-in exception handling such as the Java Virtual Machine. For
+ -- other targets this routine is simply ignored. Currently, only JGNAT
+ -- uses this. See 4jexcept.ads for details. The pragma Export allows this
+ -- routine to be accessed elsewhere in the run-time, even though it is in
+ -- the private part of this package (it is not allowed to be in the visible
+ -- part, since this is set by the reference manual).
function Exception_Name_Simple (X : Exception_Occurrence) return String;
-- Like Exception_Name, but returns the simple non-qualified name of the
procedure Raise_From_Controlled_Operation
(X : Ada.Exceptions.Exception_Occurrence);
pragma No_Return (Raise_From_Controlled_Operation);
- -- Raise Program_Error, providing information about X (an exception
- -- raised during a controlled operation) in the exception message.
+ -- Raise Program_Error, providing information about X (an exception raised
+ -- during a controlled operation) in the exception message.
procedure Reraise_Occurrence_Always (X : Exception_Occurrence);
pragma No_Return (Reraise_Occurrence_Always);
pragma No_Return (Reraise_Occurrence_No_Defer);
-- Exactly like Reraise_Occurrence, except that abort is not deferred
-- before the call and the parameter X is known not to be the null
- -- occurrence. This is used in generated code when it is known that
- -- abort is already deferred.
+ -- occurrence. This is used in generated code when it is known that abort
+ -- is already deferred.
-----------------------
-- Polling Interface --
type Exception_Occurrence is record
Id : Exception_Id;
-- Exception_Identity for this exception occurrence
+ --
-- WARNING System.System.Finalization_Implementation.Finalize_List
-- relies on the fact that this field is always first in the exception
-- occurrence
package body Ada.Exceptions is
pragma Suppress (All_Checks);
- -- We definitely do not want exceptions occurring within this unit, or
- -- we are in big trouble. If an exceptional situation does occur, better
- -- that it not be raised, since raising it can cause confusing chaos.
+ -- We definitely do not want exceptions occurring within this unit, or we
+ -- are in big trouble. If an exceptional situation does occur, better that
+ -- it not be raised, since raising it can cause confusing chaos.
-----------------------
-- Local Subprograms --
procedure To_Stderr (S : String);
pragma Export (Ada, To_Stderr, "__gnat_to_stderr");
- -- Little routine to output string to stderr that is also used
- -- in the tasking run time.
+ -- Little routine to output string to stderr that is also used in the
+ -- tasking run time.
procedure To_Stderr (C : Character);
pragma Inline (To_Stderr);
pragma Export (Ada, To_Stderr, "__gnat_to_stderr_char");
- -- Little routine to output a character to stderr, used by some of
- -- the separate units below.
+ -- Little routine to output a character to stderr, used by some of the
+ -- separate units below.
package Exception_Data is
(Id : Exception_Id;
Message : String);
-- This routine is called to setup the exception referenced by the
- -- Current_Excep field in the TSD to contain the indicated Id value
- -- and message. Message is a string which is generated as the
- -- exception message.
+ -- Current_Excep field in the TSD to contain the indicated Id value and
+ -- message. Message is a string which is generated as the exception
+ -- message.
--------------------------------------
-- Exception information subprogram --
-- Call stack traceback locations: (only if at least one location)
-- <0xyyyyyyyy 0xyyyyyyyy ...> (is recorded)
--
- -- The lines are separated by a ASCII.LF character.
- -- The nnnn is the partition Id given as decimal digits.
+ -- The lines are separated by a ASCII.LF character
+ --
+ -- The nnnn is the partition Id given as decimal digits
+ --
-- The 0x... line represents traceback program counter locations, in
-- execution order with the first one being the exception location. It
-- is present only
--
- -- The Exception_Name and Message lines are omitted in the abort
- -- signal case, since this is not really an exception.
+ -- The Exception_Name and Message lines are omitted in the abort signal
+ -- case, since this is not really an exception.
- -- !! If the format of the generated string is changed, please note
- -- !! that an equivalent modification to the routine String_To_EO must
- -- !! be made to preserve proper functioning of the stream attributes.
+ -- Note: If the format of the generated string is changed, please note
+ -- that an equivalent modification to the routine String_To_EO must be
+ -- made to preserve proper functioning of the stream attributes.
---------------------------------------
-- Exception backtracing subprograms --
procedure Unhandled_Exception_Terminate;
pragma No_Return (Unhandled_Exception_Terminate);
- -- This procedure is called to terminate execution following an
- -- unhandled exception. The exception information, including
- -- traceback if available is output, and execution is then
- -- terminated. Note that at the point where this routine is
- -- called, the stack has typically been destroyed.
+ -- This procedure is called to terminate program execution following an
+ -- unhandled exception. The exception information, including traceback
+ -- if available is output, and execution is then terminated. Note that
+ -- at the point where this routine is called, the stack has typically
+ -- been destroyed.
end Exception_Traces;
procedure Raise_With_Msg (E : Exception_Id);
pragma No_Return (Raise_With_Msg);
pragma Export (C, Raise_With_Msg, "__gnat_raise_with_msg");
- -- Raises an exception with given exception id value. A message
- -- is associated with the raise, and has already been stored in the
- -- exception occurrence referenced by the Current_Excep in the TSD.
- -- Abort is deferred before the raise call.
+ -- Raises an exception with given exception id value. A message is
+ -- associated with the raise, and has already been stored in the exception
+ -- occurrence referenced by the Current_Excep in the TSD. Abort is deferred
+ -- before the raise call.
procedure Raise_With_Location_And_Msg
(E : Exception_Id;
pragma No_Return (Raise_With_Location_And_Msg);
-- Raise an exception with given exception id value. A filename and line
-- number is associated with the raise and is stored in the exception
- -- occurrence and in addition a string message M is appended to
- -- this (if M is not null).
+ -- occurrence and in addition a string message M is appended to this
+ -- if M is not null.
procedure Raise_Constraint_Error
(File : System.Address;
procedure Reraise;
pragma No_Return (Reraise);
pragma Export (C, Reraise, "__gnat_reraise");
- -- Reraises the exception referenced by the Current_Excep field of
- -- the TSD (all fields of this exception occurrence are set). Abort
- -- is deferred before the reraise operation.
+ -- Reraises the exception referenced by the Current_Excep field of the TSD
+ -- (all fields of this exception occurrence are set). Abort is deferred
+ -- before the reraise operation.
-- Save_Occurrence variations: As the management of the private data
-- attached to occurrences is delicate, whether or not pointers to such
-- Run-Time Check Routines --
-----------------------------
- -- These routines raise a specific exception with a reason message
- -- attached. The parameters are the file name and line number in each
- -- case. The names are keyed to the codes defined in types.ads and
- -- a-types.h (for example, the name Rcheck_05 refers to the Reason
- -- RT_Exception_Code'Val (5)).
+ -- Routines to a specific exception with a reason message attached. The
+ -- parameters are the file name and line number in each case. The names are
+ -- keyed to the codes defined in types.ads and a-types.h (for example, the
+ -- name Rcheck_05 refers to the Reason RT_Exception_Code'Val (5)).
procedure Rcheck_00 (File : System.Address; Line : Integer);
procedure Rcheck_01 (File : System.Address; Line : Integer);
-- perform periodic but not systematic operations.
procedure Poll is separate;
- -- The actual polling routine is separate, so that it can easily
- -- be replaced with a target dependent version.
+ -- The actual polling routine is separate, so that it can easily be
+ -- replaced with a target dependent version.
------------------------------
-- Current_Target_Exception --
-- EO_To_String --
------------------
- -- We use the null string to represent the null occurrence, otherwise
- -- we output the Exception_Information string for the occurrence.
+ -- We use the null string to represent the null occurrence, otherwise we
+ -- output the Exception_Information string for the occurrence.
function EO_To_String (X : Exception_Occurrence) return String
renames Stream_Attributes.EO_To_String;
(X : Exception_Occurrence) return Exception_Id
is
begin
- -- Note that the following test used to be here for the original
- -- Ada 95 semantics, but these were modified by AI-241 to require
- -- returning Null_Id instead of raising Constraint_Error.
+ -- Note that the following test used to be here for the original Ada 95
+ -- semantics, but these were modified by AI-241 to require returning
+ -- Null_Id instead of raising Constraint_Error.
-- if X.Id = Null_Id then
-- raise Constraint_Error;
--------------------
package body Exception_Data is separate;
- -- This package can be easily dummied out if we do not want the
- -- basic support for exception messages (such as in Ada 83).
+ -- This package can be easily dummied out if we do not want the basic
+ -- support for exception messages (such as in Ada 83).
package body Exception_Propagation is
----------------------
package body Exception_Traces is separate;
- -- Depending on the underlying support for IO the implementation
- -- will differ. Moreover we would like to dummy out this package
- -- in case we do not want any exception tracing support. This is
- -- why this package is separated.
+ -- Depending on the underlying support for IO the implementation will
+ -- differ. Moreover we would like to dummy out this package in case we do
+ -- not want any exception tracing support. This is why this package is
+ -- separated.
-----------------------
-- Stream Attributes --
pragma Import (C, builtin_longjmp, "_gnat_builtin_longjmp");
begin
- -- WARNING: There should be no exception handler for this body
- -- because this would cause gigi to prepend a setup for a new
- -- jmpbuf to the sequence of statements in case of built-in sjljl.
- -- We would then always get this new buf in Jumpbuf_Ptr instead of the
- -- one for the exception we are handling, which would completely break
- -- the whole design of this procedure.
+ -- WARNING: There should be no exception handler for this body because
+ -- this would cause gigi to prepend a setup for a new jmpbuf to the
+ -- sequence of statements in case of built-in sjljl. We would then
+ -- always get this new buf in Jumpbuf_Ptr instead of the one for the
+ -- exception we are handling, which would completely break the whole
+ -- design of this procedure.
- -- If the jump buffer pointer is non-null, transfer control using
- -- it. Otherwise announce an unhandled exception (note that this
- -- means that we have no finalizations to do other than at the outer
- -- level). Perform the necessary notification tasks in both cases.
+ -- If the jump buffer pointer is non-null, transfer control using it.
+ -- Otherwise announce an unhandled exception (note that this means that
+ -- we have no finalizations to do other than at the outer level).
+ -- Perform the necessary notification tasks in both cases.
if Jumpbuf_Ptr /= Null_Address then
if not Excep.Exception_Raised then
begin
-- Setup Target as an exception to be propagated in the calling task
-- (rendezvous-wise), taking care not to clobber the associated private
- -- data. Target is expected to be a pointer to the calling task's
- -- fixed TSD occurrence, which is very different from Get_Current_Excep
- -- here because this subprogram is called from the called task.
+ -- data. Target is expected to be a pointer to the calling task's fixed
+ -- TSD occurrence, which is very different from Get_Current_Excep here
+ -- because this subprogram is called from the called task.
Save_Occurrence_No_Private (Target.all, Source);
end Transfer_Occurrence;
---------------
procedure To_Stderr (C : Character) is
-
type int is new Integer;
procedure put_char_stderr (C : int);