annotate gcc/ada/libgnat/s-trasym.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . T R A C E B A C K . S Y M B O L I C --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1999-2019, AdaCore --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- Run-time symbolic traceback support
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- The full capability is currently supported on the following targets:
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- GNU/Linux x86, x86_64, ia64
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 -- Note: on targets other than those listed above, a dummy implementation
kono
parents:
diff changeset
39 -- of the body returns a series of LF separated strings of the form "0x..."
kono
parents:
diff changeset
40 -- corresponding to the addresses.
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 -- The routines provided in this package assume that your application has been
kono
parents:
diff changeset
43 -- compiled with debugging information turned on, since this information is
kono
parents:
diff changeset
44 -- used to build a symbolic traceback.
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 -- If you want to retrieve tracebacks from exception occurrences, it is also
kono
parents:
diff changeset
47 -- necessary to invoke the binder with -E switch. Please refer to the gnatbind
kono
parents:
diff changeset
48 -- documentation for more information.
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 -- Note that it is also possible (and often recommended) to compute symbolic
kono
parents:
diff changeset
51 -- traceback outside the program execution, which in addition allows you to
kono
parents:
diff changeset
52 -- distribute the executable with no debug info:
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 -- - build your executable with debug info
kono
parents:
diff changeset
55 -- - archive this executable
kono
parents:
diff changeset
56 -- - strip a copy of the executable and distribute/deploy this version
kono
parents:
diff changeset
57 -- - at run time, compute absolute traceback (-bargs -E) from your
kono
parents:
diff changeset
58 -- executable and log it using Ada.Exceptions.Exception_Information
kono
parents:
diff changeset
59 -- - off line, compute the symbolic traceback using the executable archived
kono
parents:
diff changeset
60 -- with debug info and addr2line or gdb (using info line *<addr>) on the
kono
parents:
diff changeset
61 -- absolute addresses logged by your application.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 -- In order to retrieve symbolic information, functions in this package will
kono
parents:
diff changeset
64 -- read on disk all the debug information of the executable file (found via
kono
parents:
diff changeset
65 -- Argument (0), and looked in the PATH if needed) or shared libraries using
kono
parents:
diff changeset
66 -- OS facilities, and load them in memory, causing a significant cpu and
kono
parents:
diff changeset
67 -- memory overhead.
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 -- Symbolic traceback from shared libraries is only supported for Windows and
kono
parents:
diff changeset
70 -- Linux. On other targets symbolic tracebacks are only supported for the main
kono
parents:
diff changeset
71 -- executable. You should consider using gdb to obtain symbolic traceback in
kono
parents:
diff changeset
72 -- such cases.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 pragma Polling (Off);
kono
parents:
diff changeset
75 -- We must turn polling off for this unit, because otherwise we can get
kono
parents:
diff changeset
76 -- elaboration circularities when polling is turned on.
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 with Ada.Exceptions;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 package System.Traceback.Symbolic is
kono
parents:
diff changeset
81 pragma Elaborate_Body;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 function Symbolic_Traceback
kono
parents:
diff changeset
84 (Traceback : System.Traceback_Entries.Tracebacks_Array) return String;
kono
parents:
diff changeset
85 function Symbolic_Traceback_No_Hex
kono
parents:
diff changeset
86 (Traceback : System.Traceback_Entries.Tracebacks_Array) return String;
kono
parents:
diff changeset
87 -- Build a string containing a symbolic traceback of the given call
kono
parents:
diff changeset
88 -- chain. Note: These procedures may be installed by Set_Trace_Decorator,
kono
parents:
diff changeset
89 -- to get a symbolic traceback on all exceptions raised (see
kono
parents:
diff changeset
90 -- System.Exception_Traces).
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 function Symbolic_Traceback
kono
parents:
diff changeset
93 (E : Ada.Exceptions.Exception_Occurrence) return String;
kono
parents:
diff changeset
94 function Symbolic_Traceback_No_Hex
kono
parents:
diff changeset
95 (E : Ada.Exceptions.Exception_Occurrence) return String;
kono
parents:
diff changeset
96 -- Build string containing symbolic traceback of given exception occurrence
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 -- In the above, _No_Hex means do not print any hexadecimal addresses, even
kono
parents:
diff changeset
99 -- if the symbol is not available. This is useful for getting deterministic
kono
parents:
diff changeset
100 -- output from tests.
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 procedure Enable_Cache (Include_Modules : Boolean := False);
kono
parents:
diff changeset
103 -- Read symbolic information from binary files and cache them in memory.
kono
parents:
diff changeset
104 -- This will speed up the above functions but will require more memory. If
kono
parents:
diff changeset
105 -- Include_Modules is true, shared modules (or DLL) will also be cached.
kono
parents:
diff changeset
106 -- This procedure may do nothing if not supported. The profile of this
kono
parents:
diff changeset
107 -- subprogram may change in the future (new parameters can be added
kono
parents:
diff changeset
108 -- with default value), but backward compatibility for direct calls
kono
parents:
diff changeset
109 -- is supported.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 end System.Traceback.Symbolic;