annotate libstdc++-v3/libsupc++/unwind-cxx.h @ 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 // -*- C++ -*- Exception handling and frame unwind runtime interface routines.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 // Copyright (C) 2001-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 //
kono
parents:
diff changeset
4 // This file is part of GCC.
kono
parents:
diff changeset
5 //
kono
parents:
diff changeset
6 // GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
7 // it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 // the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 // any later version.
kono
parents:
diff changeset
10 //
kono
parents:
diff changeset
11 // GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
14 // GNU General Public License for more details.
kono
parents:
diff changeset
15 //
kono
parents:
diff changeset
16 // Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 // permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 // 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 // a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 // <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 // This is derived from the C++ ABI for IA-64. Where we diverge
kono
parents:
diff changeset
26 // for cross-architecture compatibility are noted with "@@@".
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 #ifndef _UNWIND_CXX_H
kono
parents:
diff changeset
29 #define _UNWIND_CXX_H 1
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 // Level 2: C++ ABI
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 #include <typeinfo>
kono
parents:
diff changeset
34 #include <exception>
kono
parents:
diff changeset
35 #include <cstddef>
kono
parents:
diff changeset
36 #include "unwind.h"
kono
parents:
diff changeset
37 #include <bits/atomic_word.h>
kono
parents:
diff changeset
38 #include <cxxabi.h>
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 #ifdef _GLIBCXX_HAVE_SYS_SDT_H
kono
parents:
diff changeset
41 #include <sys/sdt.h>
kono
parents:
diff changeset
42 /* We only want to use stap probes starting with v3. Earlier versions
kono
parents:
diff changeset
43 added too much startup cost. */
kono
parents:
diff changeset
44 #if defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
kono
parents:
diff changeset
45 #define PROBE2(name, arg1, arg2) STAP_PROBE2 (libstdcxx, name, arg1, arg2)
kono
parents:
diff changeset
46 #endif
kono
parents:
diff changeset
47 #endif
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 #ifndef PROBE2
kono
parents:
diff changeset
50 #define PROBE2(name, arg1, arg2)
kono
parents:
diff changeset
51 #endif
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 #pragma GCC visibility push(default)
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 namespace __cxxabiv1
kono
parents:
diff changeset
56 {
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 // A primary C++ exception object consists of a header, which is a wrapper
kono
parents:
diff changeset
59 // around an unwind object header with additional C++ specific information,
kono
parents:
diff changeset
60 // followed by the exception object itself.
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 struct __cxa_exception
kono
parents:
diff changeset
63 {
kono
parents:
diff changeset
64 // Manage the exception object itself.
kono
parents:
diff changeset
65 std::type_info *exceptionType;
kono
parents:
diff changeset
66 void (_GLIBCXX_CDTOR_CALLABI *exceptionDestructor)(void *);
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 // The C++ standard has entertaining rules wrt calling set_terminate
kono
parents:
diff changeset
69 // and set_unexpected in the middle of the exception cleanup process.
kono
parents:
diff changeset
70 std::unexpected_handler unexpectedHandler;
kono
parents:
diff changeset
71 std::terminate_handler terminateHandler;
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 // The caught exception stack threads through here.
kono
parents:
diff changeset
74 __cxa_exception *nextException;
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 // How many nested handlers have caught this exception. A negated
kono
parents:
diff changeset
77 // value is a signal that this object has been rethrown.
kono
parents:
diff changeset
78 int handlerCount;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 #ifdef __ARM_EABI_UNWINDER__
kono
parents:
diff changeset
81 // Stack of exceptions in cleanups.
kono
parents:
diff changeset
82 __cxa_exception* nextPropagatingException;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 // The number of active cleanup handlers for this exception.
kono
parents:
diff changeset
85 int propagationCount;
kono
parents:
diff changeset
86 #else
kono
parents:
diff changeset
87 // Cache parsed handler data from the personality routine Phase 1
kono
parents:
diff changeset
88 // for Phase 2 and __cxa_call_unexpected.
kono
parents:
diff changeset
89 int handlerSwitchValue;
kono
parents:
diff changeset
90 const unsigned char *actionRecord;
kono
parents:
diff changeset
91 const unsigned char *languageSpecificData;
kono
parents:
diff changeset
92 _Unwind_Ptr catchTemp;
kono
parents:
diff changeset
93 void *adjustedPtr;
kono
parents:
diff changeset
94 #endif
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 // The generic exception header. Must be last.
kono
parents:
diff changeset
97 _Unwind_Exception unwindHeader;
kono
parents:
diff changeset
98 };
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 struct __cxa_refcounted_exception
kono
parents:
diff changeset
101 {
kono
parents:
diff changeset
102 // Manage this header.
kono
parents:
diff changeset
103 _Atomic_word referenceCount;
kono
parents:
diff changeset
104 // __cxa_exception must be last, and no padding can be after it.
kono
parents:
diff changeset
105 __cxa_exception exc;
kono
parents:
diff changeset
106 };
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 // A dependent C++ exception object consists of a wrapper around an unwind
kono
parents:
diff changeset
109 // object header with additional C++ specific information, containing a pointer
kono
parents:
diff changeset
110 // to a primary exception object.
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 struct __cxa_dependent_exception
kono
parents:
diff changeset
113 {
kono
parents:
diff changeset
114 // The primary exception this thing depends on.
kono
parents:
diff changeset
115 void *primaryException;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 // Unused member to get similar layout to __cxa_exception, otherwise the
kono
parents:
diff changeset
118 // alignment requirements of _Unwind_Exception would require padding bytes
kono
parents:
diff changeset
119 // before the unwindHeader member.
kono
parents:
diff changeset
120 void (_GLIBCXX_CDTOR_CALLABI *__padding)(void *);
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 // The C++ standard has entertaining rules wrt calling set_terminate
kono
parents:
diff changeset
123 // and set_unexpected in the middle of the exception cleanup process.
kono
parents:
diff changeset
124 std::unexpected_handler unexpectedHandler;
kono
parents:
diff changeset
125 std::terminate_handler terminateHandler;
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 // The caught exception stack threads through here.
kono
parents:
diff changeset
128 __cxa_exception *nextException;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 // How many nested handlers have caught this exception. A negated
kono
parents:
diff changeset
131 // value is a signal that this object has been rethrown.
kono
parents:
diff changeset
132 int handlerCount;
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 #ifdef __ARM_EABI_UNWINDER__
kono
parents:
diff changeset
135 // Stack of exceptions in cleanups.
kono
parents:
diff changeset
136 __cxa_exception* nextPropagatingException;
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 // The number of active cleanup handlers for this exception.
kono
parents:
diff changeset
139 int propagationCount;
kono
parents:
diff changeset
140 #else
kono
parents:
diff changeset
141 // Cache parsed handler data from the personality routine Phase 1
kono
parents:
diff changeset
142 // for Phase 2 and __cxa_call_unexpected.
kono
parents:
diff changeset
143 int handlerSwitchValue;
kono
parents:
diff changeset
144 const unsigned char *actionRecord;
kono
parents:
diff changeset
145 const unsigned char *languageSpecificData;
kono
parents:
diff changeset
146 _Unwind_Ptr catchTemp;
kono
parents:
diff changeset
147 void *adjustedPtr;
kono
parents:
diff changeset
148 #endif
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 // The generic exception header. Must be last.
kono
parents:
diff changeset
151 _Unwind_Exception unwindHeader;
kono
parents:
diff changeset
152 };
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 // Each thread in a C++ program has access to a __cxa_eh_globals object.
kono
parents:
diff changeset
155 struct __cxa_eh_globals
kono
parents:
diff changeset
156 {
kono
parents:
diff changeset
157 __cxa_exception *caughtExceptions;
kono
parents:
diff changeset
158 unsigned int uncaughtExceptions;
kono
parents:
diff changeset
159 #ifdef __ARM_EABI_UNWINDER__
kono
parents:
diff changeset
160 __cxa_exception* propagatingExceptions;
kono
parents:
diff changeset
161 #endif
kono
parents:
diff changeset
162 };
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 // @@@ These are not directly specified by the IA-64 C++ ABI.
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 // Handles re-checking the exception specification if unexpectedHandler
kono
parents:
diff changeset
167 // throws, and if bad_exception needs to be thrown. Called from the
kono
parents:
diff changeset
168 // compiler.
kono
parents:
diff changeset
169 extern "C" void __cxa_call_unexpected (void *) __attribute__((__noreturn__));
kono
parents:
diff changeset
170 extern "C" void __cxa_call_terminate (_Unwind_Exception*) throw ()
kono
parents:
diff changeset
171 __attribute__((__noreturn__));
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 #ifdef __ARM_EABI_UNWINDER__
kono
parents:
diff changeset
174 // Arm EABI specified routines.
kono
parents:
diff changeset
175 typedef enum {
kono
parents:
diff changeset
176 ctm_failed = 0,
kono
parents:
diff changeset
177 ctm_succeeded = 1,
kono
parents:
diff changeset
178 ctm_succeeded_with_ptr_to_base = 2
kono
parents:
diff changeset
179 } __cxa_type_match_result;
kono
parents:
diff changeset
180 extern "C" __cxa_type_match_result __cxa_type_match(_Unwind_Exception*,
kono
parents:
diff changeset
181 const std::type_info*,
kono
parents:
diff changeset
182 bool, void**);
kono
parents:
diff changeset
183 extern "C" bool __cxa_begin_cleanup (_Unwind_Exception*);
kono
parents:
diff changeset
184 extern "C" void __cxa_end_cleanup (void);
kono
parents:
diff changeset
185 #endif
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 // Handles cleanup from transactional memory restart.
kono
parents:
diff changeset
188 extern "C" void __cxa_tm_cleanup (void *, void *, unsigned int) throw();
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 // Invokes given handler, dying appropriately if the user handler was
kono
parents:
diff changeset
191 // so inconsiderate as to return.
kono
parents:
diff changeset
192 extern void __terminate(std::terminate_handler) throw ()
kono
parents:
diff changeset
193 __attribute__((__noreturn__));
kono
parents:
diff changeset
194 extern void __unexpected(std::unexpected_handler)
kono
parents:
diff changeset
195 __attribute__((__noreturn__));
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 // The current installed user handlers.
kono
parents:
diff changeset
198 extern std::terminate_handler __terminate_handler;
kono
parents:
diff changeset
199 extern std::unexpected_handler __unexpected_handler;
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 // These are explicitly GNU C++ specific.
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 // Acquire the C++ exception header from the C++ object.
kono
parents:
diff changeset
204 static inline __cxa_exception *
kono
parents:
diff changeset
205 __get_exception_header_from_obj (void *ptr)
kono
parents:
diff changeset
206 {
kono
parents:
diff changeset
207 return reinterpret_cast<__cxa_exception *>(ptr) - 1;
kono
parents:
diff changeset
208 }
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 // Acquire the C++ exception header from the generic exception header.
kono
parents:
diff changeset
211 static inline __cxa_exception *
kono
parents:
diff changeset
212 __get_exception_header_from_ue (_Unwind_Exception *exc)
kono
parents:
diff changeset
213 {
kono
parents:
diff changeset
214 return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
kono
parents:
diff changeset
215 }
kono
parents:
diff changeset
216
kono
parents:
diff changeset
217 // Acquire the C++ refcounted exception header from the C++ object.
kono
parents:
diff changeset
218 static inline __cxa_refcounted_exception *
kono
parents:
diff changeset
219 __get_refcounted_exception_header_from_obj (void *ptr)
kono
parents:
diff changeset
220 {
kono
parents:
diff changeset
221 return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1;
kono
parents:
diff changeset
222 }
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 // Acquire the C++ refcounted exception header from the generic exception
kono
parents:
diff changeset
225 // header.
kono
parents:
diff changeset
226 static inline __cxa_refcounted_exception *
kono
parents:
diff changeset
227 __get_refcounted_exception_header_from_ue (_Unwind_Exception *exc)
kono
parents:
diff changeset
228 {
kono
parents:
diff changeset
229 return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1;
kono
parents:
diff changeset
230 }
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 static inline __cxa_dependent_exception *
kono
parents:
diff changeset
233 __get_dependent_exception_from_ue (_Unwind_Exception *exc)
kono
parents:
diff changeset
234 {
kono
parents:
diff changeset
235 return reinterpret_cast<__cxa_dependent_exception *>(exc + 1) - 1;
kono
parents:
diff changeset
236 }
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 #ifdef __ARM_EABI_UNWINDER__
kono
parents:
diff changeset
239 static inline bool
kono
parents:
diff changeset
240 __is_gxx_exception_class(_Unwind_Exception_Class c)
kono
parents:
diff changeset
241 {
kono
parents:
diff changeset
242 // TODO: Take advantage of the fact that c will always be word aligned.
kono
parents:
diff changeset
243 return c[0] == 'G'
kono
parents:
diff changeset
244 && c[1] == 'N'
kono
parents:
diff changeset
245 && c[2] == 'U'
kono
parents:
diff changeset
246 && c[3] == 'C'
kono
parents:
diff changeset
247 && c[4] == 'C'
kono
parents:
diff changeset
248 && c[5] == '+'
kono
parents:
diff changeset
249 && c[6] == '+'
kono
parents:
diff changeset
250 && (c[7] == '\0' || c[7] == '\x01');
kono
parents:
diff changeset
251 }
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 // Only checks for primary or dependent, but not that it is a C++ exception at
kono
parents:
diff changeset
254 // all.
kono
parents:
diff changeset
255 static inline bool
kono
parents:
diff changeset
256 __is_dependent_exception(_Unwind_Exception_Class c)
kono
parents:
diff changeset
257 {
kono
parents:
diff changeset
258 return c[7] == '\x01';
kono
parents:
diff changeset
259 }
kono
parents:
diff changeset
260
kono
parents:
diff changeset
261 static inline void
kono
parents:
diff changeset
262 __GXX_INIT_PRIMARY_EXCEPTION_CLASS(_Unwind_Exception_Class c)
kono
parents:
diff changeset
263 {
kono
parents:
diff changeset
264 c[0] = 'G';
kono
parents:
diff changeset
265 c[1] = 'N';
kono
parents:
diff changeset
266 c[2] = 'U';
kono
parents:
diff changeset
267 c[3] = 'C';
kono
parents:
diff changeset
268 c[4] = 'C';
kono
parents:
diff changeset
269 c[5] = '+';
kono
parents:
diff changeset
270 c[6] = '+';
kono
parents:
diff changeset
271 c[7] = '\0';
kono
parents:
diff changeset
272 }
kono
parents:
diff changeset
273
kono
parents:
diff changeset
274 static inline void
kono
parents:
diff changeset
275 __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(_Unwind_Exception_Class c)
kono
parents:
diff changeset
276 {
kono
parents:
diff changeset
277 c[0] = 'G';
kono
parents:
diff changeset
278 c[1] = 'N';
kono
parents:
diff changeset
279 c[2] = 'U';
kono
parents:
diff changeset
280 c[3] = 'C';
kono
parents:
diff changeset
281 c[4] = 'C';
kono
parents:
diff changeset
282 c[5] = '+';
kono
parents:
diff changeset
283 c[6] = '+';
kono
parents:
diff changeset
284 c[7] = '\x01';
kono
parents:
diff changeset
285 }
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 static inline bool
kono
parents:
diff changeset
288 __is_gxx_forced_unwind_class(_Unwind_Exception_Class c)
kono
parents:
diff changeset
289 {
kono
parents:
diff changeset
290 return c[0] == 'G'
kono
parents:
diff changeset
291 && c[1] == 'N'
kono
parents:
diff changeset
292 && c[2] == 'U'
kono
parents:
diff changeset
293 && c[3] == 'C'
kono
parents:
diff changeset
294 && c[4] == 'F'
kono
parents:
diff changeset
295 && c[5] == 'O'
kono
parents:
diff changeset
296 && c[6] == 'R'
kono
parents:
diff changeset
297 && c[7] == '\0';
kono
parents:
diff changeset
298 }
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 static inline void
kono
parents:
diff changeset
301 __GXX_INIT_FORCED_UNWIND_CLASS(_Unwind_Exception_Class c)
kono
parents:
diff changeset
302 {
kono
parents:
diff changeset
303 c[0] = 'G';
kono
parents:
diff changeset
304 c[1] = 'N';
kono
parents:
diff changeset
305 c[2] = 'U';
kono
parents:
diff changeset
306 c[3] = 'C';
kono
parents:
diff changeset
307 c[4] = 'F';
kono
parents:
diff changeset
308 c[5] = 'O';
kono
parents:
diff changeset
309 c[6] = 'R';
kono
parents:
diff changeset
310 c[7] = '\0';
kono
parents:
diff changeset
311 }
kono
parents:
diff changeset
312
kono
parents:
diff changeset
313 static inline void*
kono
parents:
diff changeset
314 __gxx_caught_object(_Unwind_Exception* eo)
kono
parents:
diff changeset
315 {
kono
parents:
diff changeset
316 return (void*)eo->barrier_cache.bitpattern[0];
kono
parents:
diff changeset
317 }
kono
parents:
diff changeset
318 #else // !__ARM_EABI_UNWINDER__
kono
parents:
diff changeset
319 // This is the primary exception class we report -- "GNUCC++\0".
kono
parents:
diff changeset
320 const _Unwind_Exception_Class __gxx_primary_exception_class
kono
parents:
diff changeset
321 = ((((((((_Unwind_Exception_Class) 'G'
kono
parents:
diff changeset
322 << 8 | (_Unwind_Exception_Class) 'N')
kono
parents:
diff changeset
323 << 8 | (_Unwind_Exception_Class) 'U')
kono
parents:
diff changeset
324 << 8 | (_Unwind_Exception_Class) 'C')
kono
parents:
diff changeset
325 << 8 | (_Unwind_Exception_Class) 'C')
kono
parents:
diff changeset
326 << 8 | (_Unwind_Exception_Class) '+')
kono
parents:
diff changeset
327 << 8 | (_Unwind_Exception_Class) '+')
kono
parents:
diff changeset
328 << 8 | (_Unwind_Exception_Class) '\0');
kono
parents:
diff changeset
329
kono
parents:
diff changeset
330 // This is the dependent (from std::rethrow_exception) exception class we report
kono
parents:
diff changeset
331 // "GNUCC++\x01"
kono
parents:
diff changeset
332 const _Unwind_Exception_Class __gxx_dependent_exception_class
kono
parents:
diff changeset
333 = ((((((((_Unwind_Exception_Class) 'G'
kono
parents:
diff changeset
334 << 8 | (_Unwind_Exception_Class) 'N')
kono
parents:
diff changeset
335 << 8 | (_Unwind_Exception_Class) 'U')
kono
parents:
diff changeset
336 << 8 | (_Unwind_Exception_Class) 'C')
kono
parents:
diff changeset
337 << 8 | (_Unwind_Exception_Class) 'C')
kono
parents:
diff changeset
338 << 8 | (_Unwind_Exception_Class) '+')
kono
parents:
diff changeset
339 << 8 | (_Unwind_Exception_Class) '+')
kono
parents:
diff changeset
340 << 8 | (_Unwind_Exception_Class) '\x01');
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 static inline bool
kono
parents:
diff changeset
343 __is_gxx_exception_class(_Unwind_Exception_Class c)
kono
parents:
diff changeset
344 {
kono
parents:
diff changeset
345 return c == __gxx_primary_exception_class
kono
parents:
diff changeset
346 || c == __gxx_dependent_exception_class;
kono
parents:
diff changeset
347 }
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 // Only checks for primary or dependent, but not that it is a C++ exception at
kono
parents:
diff changeset
350 // all.
kono
parents:
diff changeset
351 static inline bool
kono
parents:
diff changeset
352 __is_dependent_exception(_Unwind_Exception_Class c)
kono
parents:
diff changeset
353 {
kono
parents:
diff changeset
354 return (c & 1);
kono
parents:
diff changeset
355 }
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 #define __GXX_INIT_PRIMARY_EXCEPTION_CLASS(c) c = __gxx_primary_exception_class
kono
parents:
diff changeset
358 #define __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(c) \
kono
parents:
diff changeset
359 c = __gxx_dependent_exception_class
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 // GNU C++ personality routine, Version 0.
kono
parents:
diff changeset
362 extern "C" _Unwind_Reason_Code __gxx_personality_v0
kono
parents:
diff changeset
363 (int, _Unwind_Action, _Unwind_Exception_Class,
kono
parents:
diff changeset
364 struct _Unwind_Exception *, struct _Unwind_Context *);
kono
parents:
diff changeset
365
kono
parents:
diff changeset
366 // GNU C++ sjlj personality routine, Version 0.
kono
parents:
diff changeset
367 extern "C" _Unwind_Reason_Code __gxx_personality_sj0
kono
parents:
diff changeset
368 (int, _Unwind_Action, _Unwind_Exception_Class,
kono
parents:
diff changeset
369 struct _Unwind_Exception *, struct _Unwind_Context *);
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 static inline void*
kono
parents:
diff changeset
372 __gxx_caught_object(_Unwind_Exception* eo)
kono
parents:
diff changeset
373 {
kono
parents:
diff changeset
374 // Bad as it looks, this actually works for dependent exceptions too.
kono
parents:
diff changeset
375 __cxa_exception* header = __get_exception_header_from_ue (eo);
kono
parents:
diff changeset
376 return header->adjustedPtr;
kono
parents:
diff changeset
377 }
kono
parents:
diff changeset
378 #endif // !__ARM_EABI_UNWINDER__
kono
parents:
diff changeset
379
kono
parents:
diff changeset
380 static inline void*
kono
parents:
diff changeset
381 __get_object_from_ue(_Unwind_Exception* eo) throw()
kono
parents:
diff changeset
382 {
kono
parents:
diff changeset
383 return __is_dependent_exception (eo->exception_class) ?
kono
parents:
diff changeset
384 __get_dependent_exception_from_ue (eo)->primaryException :
kono
parents:
diff changeset
385 eo + 1;
kono
parents:
diff changeset
386 }
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388 static inline void *
kono
parents:
diff changeset
389 __get_object_from_ambiguous_exception(__cxa_exception *p_or_d) throw()
kono
parents:
diff changeset
390 {
kono
parents:
diff changeset
391 return __get_object_from_ue (&p_or_d->unwindHeader);
kono
parents:
diff changeset
392 }
kono
parents:
diff changeset
393
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 } /* namespace __cxxabiv1 */
kono
parents:
diff changeset
396
kono
parents:
diff changeset
397 #pragma GCC visibility pop
kono
parents:
diff changeset
398
kono
parents:
diff changeset
399 #endif // _UNWIND_CXX_H