Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -22,10 +22,11 @@ #ifdef HAVE_SEH_EXCEPTIONS # include #endif #import "runtime.h" +#import "runtime-private.h" #import "macros.h" #if defined(HAVE_DWARF_EXCEPTIONS) # define PERSONALITY __gnu_objc_personality_v0 @@ -251,11 +252,11 @@ return _Unwind_GetDataRelBase(ctx); case DW_EH_PE_textrel: return _Unwind_GetTextRelBase(ctx); } - abort(); + OBJC_ERROR("Unknown encoding!") } static size_t size_for_encoding(uint8_t enc) { @@ -271,21 +272,20 @@ return 4; case DW_EH_PE_udata8: return 8; } - abort(); + OBJC_ERROR("Unknown encoding!") } static uint64_t read_value(uint8_t enc, const uint8_t **ptr) { uint64_t value; if (enc == DW_EH_PE_aligned) - /* Not implemented */ - abort(); + OBJC_ERROR("DW_EH_PE_aligned is not implemented!") #define READ(type) \ { \ value = *(type*)(void*)*ptr; \ *ptr += size_for_encoding(enc); \ @@ -311,11 +311,11 @@ case DW_EH_PE_sdata4: READ(int32_t) case DW_EH_PE_sdata8: READ(int64_t) default: - abort(); + OBJC_ERROR("Unknown encoding!") } #undef READ return value; } @@ -499,12 +499,12 @@ *filtervalue = filter; return HANDLER_FOUND; } } else if (filter == 0) return CLEANUP_FOUND; - else - abort(); + else if (filter < 0) + OBJC_ERROR("Invalid filter!") } while (displacement != 0); return 0; } @@ -622,11 +622,11 @@ _Unwind_SetIP(ctx, landingpad); return _URC_INSTALL_CONTEXT; } - abort(); + OBJC_ERROR("Neither _UA_SEARCH_PHASE nor _UA_CLEANUP_PHASE in actions!") } static void cleanup(_Unwind_Reason_Code reason, struct _Unwind_Exception *ex) { @@ -637,11 +637,11 @@ objc_exception_throw(id object) { struct objc_exception *e; if ((e = malloc(sizeof(*e))) == NULL) - abort(); + OBJC_ERROR("Not enough memory to allocate exception!") memset(e, 0, sizeof(*e)); e->exception.class = objc_exception_class; e->exception.cleanup = cleanup; e->object = object; @@ -648,11 +648,11 @@ if (_Unwind_RaiseException(&e->exception) == _URC_END_OF_STACK && uncaught_exception_handler != NULL) uncaught_exception_handler(object); - abort(); + OBJC_ERROR("_Unwind_RaiseException() returned!") } objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler handler) {