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