Differences From Artifact [4b731d03ec]:
- File src/exceptions/OFException.m — part of check-in [7e5c81e186] at 2018-01-03 19:49:46 on branch trunk — Update copyright notice (user: js, size: 7074) [annotate] [blame] [check-ins using]
To Artifact [7a9ee871b5]:
- File
src/exceptions/OFException.m
— part of check-in
[879e69dd3d]
at
2018-04-08 18:18:16
on branch trunk
— Make usage of several _Unwind_* functions optional
This removes the special casing for Itanium and makes compilation on
OpenBSD/SPARC64 work with clang. (user: js, size: 6560) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 | # import "threading.h" #endif #if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS) # include <winerror.h> #endif | < < < < < < < < < < < < < < < < < < < > > | | < | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # import "threading.h" #endif #if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS) # include <winerror.h> #endif #if defined(OF_ARM) && !defined(__ARM_DWARF_EH__) # define HAVE_ARM_EHABI_EXCEPTIONS #endif struct _Unwind_Context; typedef enum { _URC_OK = 0, _URC_END_OF_STACK = 5 }_Unwind_Reason_Code; 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 *); #endif #ifndef HAVE_ARM_EHABI_EXCEPTIONS extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *); #else extern int _Unwind_VRS_Get(struct _Unwind_Context *, int, uint32_t, int, void *); #endif #if !defined(HAVE_STRERROR_R) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; OF_CONSTRUCTOR() { |
︙ | ︙ | |||
221 222 223 224 225 226 227 | } # endif #endif return ret; } | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | } # endif #endif return ret; } #ifdef HAVE__UNWIND_BACKTRACE static _Unwind_Reason_Code backtrace_callback(struct _Unwind_Context *ctx, void *data) { struct backtrace_ctx *bt = data; if (bt->i < OF_BACKTRACE_SIZE) { # ifndef HAVE_ARM_EHABI_EXCEPTIONS |
︙ | ︙ | |||
249 250 251 252 253 254 255 | @implementation OFException + (instancetype)exception { return [[[self alloc] init] autorelease]; } | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | @implementation OFException + (instancetype)exception { return [[[self alloc] init] autorelease]; } #ifdef HAVE__UNWIND_BACKTRACE - (instancetype)init { struct backtrace_ctx ctx; self = [super init]; ctx.backtrace = _backtrace; |
︙ | ︙ | |||
272 273 274 275 276 277 278 | { return [OFString stringWithFormat: @"An exception of type %@ occurred!", [self class]]; } - (OFArray OF_GENERIC(OFString *) *)backtrace { | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | { return [OFString stringWithFormat: @"An exception of type %@ occurred!", [self class]]; } - (OFArray OF_GENERIC(OFString *) *)backtrace { #ifdef HAVE__UNWIND_BACKTRACE OFMutableArray OF_GENERIC(OFString *) *backtrace = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); for (uint8_t i = 0; i < OF_BACKTRACE_SIZE && _backtrace[i] != NULL; i++) { # ifdef HAVE_DLADDR |
︙ | ︙ |