@@ -91,6 +91,19 @@ package body GNAT.Exception_Actions is
procedure Core_Dump (Occurrence : Exception_Occurrence) is separate;
+ --------------------------
+ -- Is_Foreign_Exception --
+ --------------------------
+
+ function Is_Foreign_Exception (E : Exception_Occurrence) return Boolean is
+ Foreign_Exception : aliased Exception_Data;
+ pragma Import
+ (Ada, Foreign_Exception, "system__exceptions__foreign_exception");
+ begin
+ return (To_Data (Exception_Identity (E))
+ = Foreign_Exception'Unchecked_Access);
+ end Is_Foreign_Exception;
+
----------------
-- Name_To_Id --
----------------
@@ -29,9 +29,11 @@
-- --
------------------------------------------------------------------------------
+-- This package provides support for callbacks on exceptions as well as
+-- exception-related utility subprograms of possible interest together with
+-- exception actions or more generally.
+-- The callbacks are called immediately when either a specific exception,
-- or any exception, is raised, before any other actions taken by raise, in
-- particular before any unwinding of the stack occurs.
@@ -85,6 +87,10 @@ package GNAT.Exception_Actions is
-- Note: All non-predefined exceptions will return Null_Id for programs
-- compiled with pragma Restriction (No_Exception_Registration)
+ function Is_Foreign_Exception (E : Exception_Occurrence) return Boolean;
+ -- Tell whether the exception occurrence E represents a foreign exception,
+ -- such as one raised in C++ and caught by a when others choice in Ada.
+
function Registered_Exceptions_Count return Natural;
-- Return the number of exceptions that have been registered so far.
-- Exceptions declared locally will not appear in this list until their