diff options
author | David Chisnall <dchisnall@pathscale.com> | 2011-11-25 12:16:58 +0000 |
---|---|---|
committer | David Chisnall <dchisnall@pathscale.com> | 2011-11-25 12:16:58 +0000 |
commit | c106344e1ff40b3dc46304a05f1518150b07aa53 (patch) | |
tree | ad735427cc163dadf685d502c16bed4ee7481cec /src/exception.cc | |
parent | c996267251a83097aa4bac0b350801e92d6fc20a (diff) | |
download | libcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.gz libcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.bz2 libcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.xz |
Finished ARM EH enough that it passes the test suite. Still to do:
properly handle nested cleanups.
Diffstat (limited to 'src/exception.cc')
-rw-r--r-- | src/exception.cc | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/src/exception.cc b/src/exception.cc index 3b99735..64e78a7 100644 --- a/src/exception.cc +++ b/src/exception.cc @@ -656,7 +656,6 @@ extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void*)) { - fprintf(stderr, "Thrown exception: %p\n", thrown_exception); __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; ex->referenceCount = 1; @@ -899,19 +898,25 @@ static handler_type check_action_record(_Unwind_Context *context, } else if (filter < 0 && 0 != ex) { - unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1); bool matched = false; *selector = filter; - while (*type_index) - { #ifdef __arm__ - //fprintf(stderr, "Filter: %d\n", filter); - std::type_info *handler_type = handler_type = get_type_info_entry(context, lsda, -filter - 1); - //fprintf(stderr, "Handler: %p\n", handler_type); - type_index++; + filter++; + std::type_info *handler_type = get_type_info_entry(context, lsda, filter--); + while (handler_type) + { + if (check_type_signature(ex, handler_type, adjustedPtr)) + { + matched = true; + break; + } + handler_type = get_type_info_entry(context, lsda, filter--); + } #else + unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1); + while (*type_index) + { std::type_info *handler_type = get_type_info_entry(context, lsda, *(type_index++)); -#endif // If the exception spec matches a permitted throw type for // this function, don't report a handler - we are allowed to // propagate this exception out. @@ -921,6 +926,7 @@ static handler_type check_action_record(_Unwind_Context *context, break; } } +#endif if (matched) { continue; } // If we don't find an allowed exception spec, we need to install // the context for this action. The landing pad will then call the @@ -1084,7 +1090,6 @@ extern "C" void *__cxa_begin_catch(void *e) throw() extern "C" void *__cxa_begin_catch(void *e) #endif { - fprintf(stderr, "Entering catch\n"); // Decrement the uncaught exceptions count __cxa_eh_globals *globals = __cxa_get_globals(); globals->uncaughtExceptions--; @@ -1130,13 +1135,8 @@ extern "C" void *__cxa_begin_catch(void *e) ex->handlerCount++; } - fprintf(stderr, "Exception base pointer: %p\n", ((char*)exceptionObject + sizeof(_Unwind_Exception))); - fprintf(stderr, "Exception edjusted pointer: %p\n", ex->adjustedPtr); - fprintf(stderr, "Exception as int: %d\n", *(int*)((char*)exceptionObject + sizeof(_Unwind_Exception))); - return ex->adjustedPtr; } - fprintf(stderr, "Exception as int: %d\n", *(int*)((char*)exceptionObject + sizeof(_Unwind_Exception))); // exceptionObject is the pointer to the _Unwind_Exception within the // __cxa_exception. The throw object is after this return ((char*)exceptionObject + sizeof(_Unwind_Exception)); @@ -1150,7 +1150,6 @@ extern "C" void *__cxa_begin_catch(void *e) */ extern "C" void __cxa_end_catch() { - fprintf(stderr, "Leaving catch\n"); // We can call the fast version here because the slow version is called in // __cxa_throw(), which must have been called before we end a catch block __cxa_eh_globals *globals = __cxa_get_globals_fast(); @@ -1196,20 +1195,6 @@ extern "C" void __cxa_end_catch() } } -/* -extern "C" void __cxa_end_cleanup(_Unwind_Exception* exceptionObject) -{ - _Unwind_Resume(0); -// fprintf(stderr, "Leaving cleanup\n"); -} - -extern "C" bool __cxa_begin_cleanup(_Unwind_Exception* exceptionObject) -{ - fprintf(stderr, "Entering cleanup\n"); - return true; -} -*/ - /** * ABI function. Returns the type of the current exception. */ |