ObjFW  Diff

Differences From Artifact [9b10a5e2e6]:

To Artifact [03e1d50c2c]:


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 {







|







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

#if defined(HAVE_DWARF_EXCEPTIONS) || defined(OBJC_ZEROCOST_EXCEPTIONS)
struct _Unwind_Context;
typedef enum {
	_URC_OK		  = 0,
	_URC_END_OF_STACK = 5
}_Unwind_Reason_Code;

struct backtrace_ctx {
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

@implementation OFException
+ (instancetype)exception
{
	return [[[self alloc] init] autorelease];
}

#ifdef HAVE_DWARF_EXCEPTIONS
- init
{
	struct backtrace_ctx ctx;

	self = [super init];

	ctx.backtrace = _backtrace;







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

@implementation OFException
+ (instancetype)exception
{
	return [[[self alloc] init] autorelease];
}

#if defined(HAVE_DWARF_EXCEPTIONS) || defined(OBJC_ZEROCOST_EXCEPTIONS)
- init
{
	struct backtrace_ctx ctx;

	self = [super init];

	ctx.backtrace = _backtrace;
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
	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;







|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
	return [OFString stringWithFormat:
	    @"An exception of type %@ occurred!", [self class]];
}

- (OFArray*)backtrace
{
#if defined(HAVE_DWARF_EXCEPTIONS) || defined(OBJC_ZEROCOST_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;