1 // Copyright (C) 2009-2017 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
21 #include <testsuite_hooks.h>
23 // Before exception_ptr was introduced, some programs copied
24 // part of unwind-cxx.h and used __cxa_get_globals to get at the
25 // current exceptionType. __cxa_exception structure is described in the
26 // C++ ABI, so they have the right to assume it works.
29 struct __cxa_exception
31 std::type_info
*exceptionType
;
32 void (*exceptionDestructor
)(void *);
33 std::unexpected_handler unexpectedHandler
;
34 std::terminate_handler terminateHandler
;
35 __cxa_exception
*nextException
;
37 #ifdef __ARM_EABI_UNWINDER__
38 __cxa_exception
* nextPropagatingException
;
41 int handlerSwitchValue
;
42 const unsigned char *actionRecord
;
43 const unsigned char *languageSpecificData
;
44 _Unwind_Ptr catchTemp
;
47 _Unwind_Exception unwindHeader
;
50 struct __cxa_eh_globals
52 __cxa_exception
*caughtExceptions
;
53 unsigned int uncaughtExceptions
;
54 #ifdef __ARM_EABI_UNWINDER__
55 __cxa_exception
* propagatingExceptions
;
59 extern "C" __cxa_eh_globals
*__cxa_get_globals () throw();
67 __cxa_exception
*exc
= __cxa_get_globals()->caughtExceptions
;
69 VERIFY ( typeid(int) == *exc
->exceptionType
);
74 __cxa_exception
*exc
= __cxa_get_globals()->caughtExceptions
;
76 VERIFY ( typeid(long long int) == *exc
->exceptionType
);
81 __cxa_exception
*exc
= __cxa_get_globals()->caughtExceptions
;
83 VERIFY ( typeid(double) == *exc
->exceptionType
);