2014-11-18 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / ada / s-exctra.ads
blob956f531284ce23e77e1261a5396c21912ff496c2
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . E X C E P T I O N _ T R A C E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2000-2014, AdaCore --
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 ------------------------------------------------------------------------------
32 -- This package provides an interface allowing to control *automatic* output
33 -- to standard error upon exception occurrences (as opposed to explicit
34 -- generation of traceback information using System.Traceback).
36 -- This output includes the basic information associated with the exception
37 -- (name, message) as well as a backtrace of the call chain at the point
38 -- where the exception occurred. This backtrace is only output if the call
39 -- chain information is available, depending if the binder switch dedicated
40 -- to that purpose has been used or not.
42 -- The default backtrace is in the form of absolute code locations which may
43 -- be converted to corresponding source locations using the addr2line utility
44 -- or from within GDB. Please refer to System.Traceback for information about
45 -- what is necessary to be able to exploit this possibility.
47 -- The backtrace output can also be customized by way of a "decorator" which
48 -- may return any string output in association with a provided call chain.
49 -- The decorator replaces the default backtrace mentioned above.
51 with System.Traceback_Entries;
53 package System.Exception_Traces is
55 -- The following defines the exact situations in which raises will
56 -- cause automatic output of trace information.
58 type Trace_Kind is
59 (Every_Raise,
60 -- Denotes the initial raise event for any exception occurrence, either
61 -- explicit or due to a specific language rule, within the context of a
62 -- task or not.
64 Unhandled_Raise
65 -- Denotes the raise events corresponding to exceptions for which there
66 -- is no user defined handler, in particular, when a task dies due to an
67 -- unhandled exception.
70 -- The following procedures can be used to activate and deactivate
71 -- traces identified by the above trace kind values.
73 procedure Trace_On (Kind : Trace_Kind);
74 -- Activate the traces denoted by Kind
76 procedure Trace_Off;
77 -- Stop the tracing requested by the last call to Trace_On.
78 -- Has no effect if no such call has ever occurred.
80 -- The following provide the backtrace decorating facilities
82 type Traceback_Decorator is access
83 function (Traceback : Traceback_Entries.Tracebacks_Array) return String;
84 -- A backtrace decorator is a function which returns the string to be
85 -- output for a call chain provided by way of a tracebacks array.
87 procedure Set_Trace_Decorator (Decorator : Traceback_Decorator);
88 -- Set the decorator to be used for future automatic outputs. Restore
89 -- the default behavior (output of raw addresses) if the provided
90 -- access value is null.
92 -- Note: System.Traceback.Symbolic.Symbolic_Traceback may be used as the
93 -- Decorator, to get a symbolic traceback. This will cause a significant
94 -- cpu and memory overhead.
96 end System.Exception_Traces;