forked from getsentry/sentry-cocoa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSentryCrashDefaultMachineContextWrapper.m
More file actions
58 lines (47 loc) · 1.48 KB
/
SentryCrashDefaultMachineContextWrapper.m
File metadata and controls
58 lines (47 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#import "SentryCrashDefaultMachineContextWrapper.h"
#import "SentryCrashDynamicLinker.h"
#import "SentryCrashMachineContext.h"
#import "SentryCrashMachineContextWrapper.h"
#import "SentryCrashStackCursor.h"
#import "SentryCrashStackCursor_SelfThread.h"
#import "SentryCrashThread.h"
#import "SentryFormatter.h"
#import "SentryFrame.h"
#import "SentryStacktrace.h"
#import "SentryStacktraceBuilder.h"
#import "SentryThread.h"
#import <Foundation/Foundation.h>
#include <execinfo.h>
#include <pthread.h>
NS_ASSUME_NONNULL_BEGIN
SentryCrashThread mainThreadID;
@implementation SentryCrashDefaultMachineContextWrapper
+ (void)load
{
mainThreadID = pthread_mach_thread_np(pthread_self());
}
- (void)fillContextForCurrentThread:(struct SentryCrashMachineContext *)context
{
sentrycrashmc_getContextForThread(sentrycrashthread_self(), context, YES);
}
- (int)getThreadCount:(struct SentryCrashMachineContext *)context
{
return sentrycrashmc_getThreadCount(context);
}
- (SentryCrashThread)getThread:(struct SentryCrashMachineContext *)context withIndex:(int)index
{
SentryCrashThread thread = sentrycrashmc_getThreadAtIndex(context, index);
return thread;
}
- (BOOL)getThreadName:(const SentryCrashThread)thread
andBuffer:(char *const)buffer
andBufLength:(int)bufLength;
{
return sentrycrashthread_getThreadName(thread, buffer, bufLength) == true;
}
- (BOOL)isMainThread:(SentryCrashThread)thread
{
return thread == mainThreadID;
}
@end
NS_ASSUME_NONNULL_END