From e32717fc8929c80c03c13fbd584437d93605acff Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 10 Jul 2008 01:57:16 +0100 Subject: [PATCH] unwind-cxx.h (__is_gxx_forced_unwind_class, [...]): Define for ARM EABI unwinder. * libsupc++/unwind-cxx.h (__is_gxx_forced_unwind_class, __GXX_INIT_FORCED_UNWIND_CLASS): Define for ARM EABI unwinder. * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Call __GXX_INIT_FORCED_UNWIND_CLASS for forced unwind with ARM EABI unwinder. * libsupc++/eh_arm.cc (__cxa_type_match): Use __is_gxx_forced_unwind_class to check for forced unwind. From-SVN: r137683 --- libstdc++-v3/ChangeLog | 10 +++++++++ libstdc++-v3/libsupc++/eh_arm.cc | 8 +++++--- libstdc++-v3/libsupc++/eh_personality.cc | 8 ++++++-- libstdc++-v3/libsupc++/unwind-cxx.h | 26 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 41acdb5120f..4271416deb9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2008-07-09 Joseph Myers + + * libsupc++/unwind-cxx.h (__is_gxx_forced_unwind_class, + __GXX_INIT_FORCED_UNWIND_CLASS): Define for ARM EABI unwinder. + * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Call + __GXX_INIT_FORCED_UNWIND_CLASS for forced unwind with ARM EABI + unwinder. + * libsupc++/eh_arm.cc (__cxa_type_match): Use + __is_gxx_forced_unwind_class to check for forced unwind. + 2008-07-09 Andreas Beckmann PR libstdc++/36552 diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc index e1e4851604b..6f770e95663 100644 --- a/libstdc++-v3/libsupc++/eh_arm.cc +++ b/libstdc++-v3/libsupc++/eh_arm.cc @@ -46,12 +46,14 @@ __cxa_type_match(_Unwind_Exception* ue_header, bool is_reference __attribute__((__unused__)), void** thrown_ptr_p) { - bool foreign_exception = !__is_gxx_exception_class(ue_header->exception_class); + bool forced_unwind = __is_gxx_forced_unwind_class(ue_header->exception_class); + bool foreign_exception = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class); __cxa_exception* xh = __get_exception_header_from_ue(ue_header); const std::type_info* throw_type; - // XXX What to do with forced unwind? - if (foreign_exception) + if (forced_unwind) + throw_type = &typeid(abi::__forced_unwind); + else if (foreign_exception) throw_type = &typeid(abi::__foreign_exception); else throw_type = xh->exceptionType; diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc index 86cfbafc229..b7d957c4d37 100644 --- a/libstdc++-v3/libsupc++/eh_personality.cc +++ b/libstdc++-v3/libsupc++/eh_personality.cc @@ -544,8 +544,12 @@ PERSONALITY_FUNCTION (int version, #ifdef __ARM_EABI_UNWINDER__ throw_type = ue_header; - if ((actions & _UA_FORCE_UNWIND) - || foreign_exception) + if (actions & _UA_FORCE_UNWIND) + { + __GXX_INIT_FORCED_UNWIND_CLASS(ue_header->exception_class); + thrown_ptr = 0; + } + else if (foreign_exception) thrown_ptr = 0; #else // During forced unwinding, match a magic exception type. diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h index c5636556434..75874fc5da4 100644 --- a/libstdc++-v3/libsupc++/unwind-cxx.h +++ b/libstdc++-v3/libsupc++/unwind-cxx.h @@ -201,6 +201,32 @@ __GXX_INIT_EXCEPTION_CLASS(_Unwind_Exception_Class c) c[7] = '\0'; } +static inline bool +__is_gxx_forced_unwind_class(_Unwind_Exception_Class c) +{ + return c[0] == 'G' + && c[1] == 'N' + && c[2] == 'U' + && c[3] == 'C' + && c[4] == 'F' + && c[5] == 'O' + && c[6] == 'R' + && c[7] == '\0'; +} + +static inline void +__GXX_INIT_FORCED_UNWIND_CLASS(_Unwind_Exception_Class c) +{ + c[0] = 'G'; + c[1] = 'N'; + c[2] = 'U'; + c[3] = 'C'; + c[4] = 'F'; + c[5] = 'O'; + c[6] = 'R'; + c[7] = '\0'; +} + static inline void* __gxx_caught_object(_Unwind_Exception* eo) {