Overview
Comment: | Only use _Unwind_Backtrace() if we have DWARF EH. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2bdac84cf3a962423a6f134be2a0f32f |
User & Date: | js on 2013-08-20 19:03:44 |
Other Links: | manifest | tags |
Context
2013-08-22
| ||
12:38 | Fix ObjFW.h. check-in: cbe0df82d9 user: js tags: trunk | |
2013-08-20
| ||
19:03 | Only use _Unwind_Backtrace() if we have DWARF EH. check-in: 2bdac84cf3 user: js tags: trunk | |
2013-08-15
| ||
20:23 | OFZIPArchiveEntry: Export the extra field. check-in: bf0db50a84 user: js tags: trunk | |
Changes
Modified src/exceptions/OFException.m from [84994201ec] to [9b10a5e2e6].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "autorelease.h" #if defined(_WIN32) && defined(OF_HAVE_SOCKETS) # include <errno.h> # include <winerror.h> #endif struct _Unwind_Context; typedef enum { _URC_OK = 0, _URC_END_OF_STACK = 5 }_Unwind_Reason_Code; struct backtrace_ctx { | > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #import "autorelease.h" #if defined(_WIN32) && defined(OF_HAVE_SOCKETS) # include <errno.h> # include <winerror.h> #endif #ifdef HAVE_DWARF_EXCEPTIONS struct _Unwind_Context; typedef enum { _URC_OK = 0, _URC_END_OF_STACK = 5 }_Unwind_Reason_Code; struct backtrace_ctx { |
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | bt->backtrace[bt->i++] = (void*)_Unwind_GetIP(ctx); #endif return _URC_OK; } return _URC_END_OF_STACK; } #if defined(_WIN32) && defined(OF_HAVE_SOCKETS) int of_wsaerr_to_errno(int wsaerr) { switch (wsaerr) { case WSAEACCES: | > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | bt->backtrace[bt->i++] = (void*)_Unwind_GetIP(ctx); #endif return _URC_OK; } return _URC_END_OF_STACK; } #endif #if defined(_WIN32) && defined(OF_HAVE_SOCKETS) int of_wsaerr_to_errno(int wsaerr) { switch (wsaerr) { case WSAEACCES: |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | @implementation OFException + (instancetype)exception { return [[[self alloc] init] autorelease]; } - init { struct backtrace_ctx ctx; self = [super init]; ctx.backtrace = _backtrace; ctx.i = 0; _Unwind_Backtrace(backtrace_callback, &ctx); return self; } - (OFString*)description { return [OFString stringWithFormat: @"An exception of type %@ occurred!", [self class]]; } - (OFArray*)backtrace { OFMutableArray *backtrace = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); uint_fast8_t i; for (i = 0; i < OF_BACKTRACE_SIZE && _backtrace[i] != NULL; i++) { #ifdef HAVE_DLADDR Dl_info info; | > > > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | @implementation OFException + (instancetype)exception { return [[[self alloc] init] autorelease]; } #ifdef HAVE_DWARF_EXCEPTIONS - init { struct backtrace_ctx ctx; self = [super init]; ctx.backtrace = _backtrace; ctx.i = 0; _Unwind_Backtrace(backtrace_callback, &ctx); return self; } #endif - (OFString*)description { return [OFString stringWithFormat: @"An exception of type %@ occurred!", [self class]]; } - (OFArray*)backtrace { #ifdef HAVE_DWARF_EXCEPTIONS OFMutableArray *backtrace = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); uint_fast8_t i; for (i = 0; i < OF_BACKTRACE_SIZE && _backtrace[i] != NULL; i++) { #ifdef HAVE_DLADDR Dl_info info; |
︙ | ︙ | |||
157 158 159 160 161 162 163 164 165 | } objc_autoreleasePoolPop(pool); [backtrace makeImmutable]; return backtrace; } @end | > > > | 162 163 164 165 166 167 168 169 170 171 172 173 | } objc_autoreleasePoolPop(pool); [backtrace makeImmutable]; return backtrace; #else return nil; #endif } @end |