From 0f29a300da1302eb27b0c5f561834d3a7ce5dfe4 Mon Sep 17 00:00:00 2001 From: anonymous Date: Thu, 25 Nov 2010 04:16:44 +0000 Subject: Fixed throwing / catching pointers. --- src/exception.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/exception.cc') diff --git a/src/exception.cc b/src/exception.cc index bdf42a8..ecc3732 100644 --- a/src/exception.cc +++ b/src/exception.cc @@ -583,6 +583,11 @@ static std::type_info *get_type_info_entry(_Unwind_Context *context, static bool check_type_signature(__cxa_exception *ex, std::type_info *type) { void *exception_ptr = (void*)(ex+1); + __pointer_type_info *ptr_type = dynamic_cast<__pointer_type_info*>(ex->exceptionType); + if (0 != ptr_type) + { + exception_ptr = *(void**)exception_ptr; + } // Always match a catchall, even with a foreign exception // // Note: A 0 here is a catchall, not a cleanup, so we return true to @@ -613,6 +618,15 @@ static bool check_type_signature(__cxa_exception *ex, std::type_info *type) ex->adjustedPtr = cls_type->cast_to(exception_ptr, target_cls_type); return 0 != ex->adjustedPtr; } + __pointer_type_info *target_ptr_type = dynamic_cast<__pointer_type_info*>(type); + if ((0 != ptr_type) && (0 != target_ptr_type) && + (ptr_type->__pointee == target_ptr_type->__pointee) && + ((target_ptr_type->__flags & ~__pbase_type_info::__const_mask) == + ptr_type->__flags)) + { + ex->adjustedPtr = exception_ptr; + return true; + } return false; } /** -- cgit v1.2.3