@@ -41,33 +41,14 @@ #if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS) # include #endif -/* - * Define HAVE_DWARF_EXCEPTIONS if OBJC_ZEROCOST_EXCEPTIONS is defined, but - * don't do so on iOS, as it is defined there even if SjLj exceptions are used. - */ -#ifndef HAVE_DWARF_EXCEPTIONS -# if defined(OBJC_ZEROCOST_EXCEPTIONS) && !defined(OF_IOS) -# define HAVE_DWARF_EXCEPTIONS -# endif -#endif - -/* - * Define HAVE_DWARF_EXCEPTIONS if HAVE_SEH_EXCEPTIONS is defined, as SEH - * exceptions are implemented as a wrapper around DWARF exceptions. - */ -#ifdef HAVE_SEH_EXCEPTIONS -# define HAVE_DWARF_EXCEPTIONS -#endif - #if defined(OF_ARM) && !defined(__ARM_DWARF_EH__) # define HAVE_ARM_EHABI_EXCEPTIONS #endif -#ifdef HAVE_DWARF_EXCEPTIONS struct _Unwind_Context; typedef enum { _URC_OK = 0, _URC_END_OF_STACK = 5 }_Unwind_Reason_Code; @@ -75,18 +56,19 @@ struct backtrace_ctx { void **backtrace; uint8_t i; }; +#ifdef HAVE__UNWIND_BACKTRACE extern _Unwind_Reason_Code _Unwind_Backtrace( _Unwind_Reason_Code (*)(struct _Unwind_Context *, void *), void *); -# ifndef HAVE_ARM_EHABI_EXCEPTIONS +#endif +#ifndef HAVE_ARM_EHABI_EXCEPTIONS extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *); -# else +#else extern int _Unwind_VRS_Get(struct _Unwind_Context *, int, uint32_t, int, void *); -# endif #endif #if !defined(HAVE_STRERROR_R) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; @@ -223,11 +205,11 @@ #endif return ret; } -#ifdef HAVE_DWARF_EXCEPTIONS +#ifdef HAVE__UNWIND_BACKTRACE static _Unwind_Reason_Code backtrace_callback(struct _Unwind_Context *ctx, void *data) { struct backtrace_ctx *bt = data; @@ -251,11 +233,11 @@ + (instancetype)exception { return [[[self alloc] init] autorelease]; } -#ifdef HAVE_DWARF_EXCEPTIONS +#ifdef HAVE__UNWIND_BACKTRACE - (instancetype)init { struct backtrace_ctx ctx; self = [super init]; @@ -274,11 +256,11 @@ @"An exception of type %@ occurred!", [self class]]; } - (OFArray OF_GENERIC(OFString *) *)backtrace { -#ifdef HAVE_DWARF_EXCEPTIONS +#ifdef HAVE__UNWIND_BACKTRACE OFMutableArray OF_GENERIC(OFString *) *backtrace = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); for (uint8_t i = 0;