ObjFW  Diff

Differences From Artifact [76191c1054]:

To Artifact [6a81d34ff8]:


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 {







>
>
>
>
>
|
>
>
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#import "autorelease.h"

#if defined(_WIN32) && defined(OF_HAVE_SOCKETS)
# include <errno.h>
# include <winerror.h>
#endif

/*
 * Define HAVE_DWARF_EXCEPTIONS if OBJC_ZEROCOST_EXCEPTIONS is defined, but
 * don't do so on 32-bit ARM, as it is defined there even if SjLj exceptions
 * are used.
 */
#if defined(OBJC_ZEROCOST_EXCEPTIONS) && !defined(__ARMEL__)
# define HAVE_DWARF_EXCEPTIONS
#endif

#ifdef HAVE_DWARF_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];
}

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

	self = [super init];

	ctx.backtrace = _backtrace;







|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

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

#ifdef HAVE_DWARF_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
{
#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;







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
{
	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;