1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . T R A C E B A C K --
9 -- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides a method for generating a traceback of the current
33 -- execution location. The traceback shows the locations of calls in the call
34 -- chain, up to either the top or a designated number of levels.
39 -- We must turn polling off for this unit, because otherwise we get
40 -- elaboration circularities with System.Exception_Tables.
42 package System
.Traceback
is
49 (Traceback
: System
.Address
;
52 Exclude_Min
: System
.Address
:= System
.Null_Address
;
53 Exclude_Max
: System
.Address
:= System
.Null_Address
;
54 Skip_Frames
: Natural := 1);
55 -- Store up to Max_Len code locations in Traceback, corresponding to
56 -- the current call chain.
58 -- Traceback is the address of an array of addresses where the
59 -- result will be stored.
61 -- Max_Len is the length of the Traceback array. If the call chain is
62 -- longer than this, then additional entries are discarded, and the
63 -- traceback is missing some of the highest level entries.
65 -- Len is the returned number of addresses stored in the Traceback array
67 -- Exclude_Min/Exclude_Max, if non null, provide a range of addresses
68 -- to ignore from the computation of the traceback.
70 -- Skip_Frames says how many of the most recent calls should at least
71 -- be excluded from the result, regardless of the exclusion bounds and
72 -- starting with this procedure itself: 1 means exclude the frame for
73 -- this procedure, 2 means 1 + exclude the frame for this procedure's
76 -- On return, the Traceback array is filled in, and Len indicates the
77 -- number of stored entries. The first entry is the most recent call,
78 -- and the last entry is the highest level call.
81 (Traceback
: System
.Address
;
84 pragma Export
(C
, C_Call_Chain
, "system__traceback__c_call_chain");
85 -- Version that can be used directly from C