ObjFW  Check-in [0e854d19bf]

Overview
Comment:Fix backtraces when using the Apple runtime.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0e854d19bf6fd9f7e120af60e8335e9d928d615f6a763fea974f69bb1e2b7a17
User & Date: js on 2013-08-25 20:42:41
Other Links: manifest | tags
Context
2013-08-25
20:59
Add -[OFString stringByDeletingPathExtension]. check-in: 0222de872b user: js tags: trunk
20:42
Fix backtraces when using the Apple runtime. check-in: 0e854d19bf user: js tags: trunk
12:14
Add -[OFArray componentsJoinedByString:options:]. check-in: f975b722df user: js tags: trunk
Changes

Modified src/exceptions/OFException.m from [9b10a5e2e6] to [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;