Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v6.10.1 #1149

Merged
merged 16 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ steps:
- label: 'iOS 13 E2E tests batch 1'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand All @@ -37,7 +37,7 @@ steps:
- label: 'iOS 13 E2E tests batch 2'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand All @@ -64,7 +64,7 @@ steps:
- label: 'iOS 12 E2E tests batch 1'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand All @@ -91,7 +91,7 @@ steps:
- label: 'iOS 12 E2E tests batch 2'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand Down
8 changes: 4 additions & 4 deletions .buildkite/pipeline.quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ steps:
- label: 'iOS 14 E2E tests batch 1'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand Down Expand Up @@ -166,7 +166,7 @@ steps:
- label: 'iOS 14 E2E tests batch 2'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand Down Expand Up @@ -194,7 +194,7 @@ steps:
- label: 'iOS 10 E2E tests batch 1'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand All @@ -221,7 +221,7 @@ steps:
- label: 'iOS 10 E2E tests batch 2'
depends_on:
- cocoa_fixture
timeout_in_minutes: 45
timeout_in_minutes: 60
agents:
queue: opensource
plugins:
Expand Down
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
author: "Bugsnag Inc"
clean: false # avoid deleting docs/.git
framework_root: "Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.10.0/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.10.1/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa"
hide_documentation_coverage: true
module: "Bugsnag"
module_version: "6.10.0"
module_version: "6.10.1"
objc: true
output: "docs"
readme: "README.md"
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "6.10.0",
"version": "6.10.1",
"summary": "The Bugsnag crash reporting framework for Apple platforms.",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v6.10.0"
"tag": "v6.10.1"
},
"frameworks": [
"Foundation",
Expand Down
12 changes: 10 additions & 2 deletions Bugsnag/Delivery/BSGEventUploadOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "BSGEventUploadOperation.h"

#import "BSGFileLocations.h"
#import "BSGInternalErrorReporter.h"
#import "BSG_RFC3339DateTool.h"
#import "BugsnagAppWithState+Private.h"
#import "BugsnagConfiguration+Private.h"
Expand Down Expand Up @@ -174,9 +175,16 @@ - (void)start {
self.state = BSGEventUploadOperationStateExecuting;
[self didChangeValueForKey:NSStringFromSelector(@selector(isExecuting))];

[self runWithDelegate:delegate completionHandler:^{
@try {
[self runWithDelegate:delegate completionHandler:^{
[self setFinished];
}];
} @catch (NSException *exception) {
[BSGInternalErrorReporter.sharedInstance reportException:exception diagnostics:nil groupingHash:
[NSString stringWithFormat:@"BSGEventUploadOperation -[runWithDelegate:completionHandler:] %@ %@",
exception.name, exception.reason]];
[self setFinished];
}];
}
}

- (void)setFinished {
Expand Down
8 changes: 8 additions & 0 deletions Bugsnag/Helpers/BSGInternalErrorReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ FOUNDATION_EXPORT NSString *BSGErrorDescription(NSError *error);
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash;

- (void)reportException:(NSException *)exception
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash;

// Private

- (nullable BugsnagEvent *)eventWithErrorClass:(NSString *)errorClass
message:(nullable NSString *)message
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash;

- (nullable BugsnagEvent *)eventWithException:(NSException *)exception
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash;

- (nullable NSURLRequest *)requestForEvent:(BugsnagEvent *)event error:(NSError * __autoreleasing *)errorPtr;

@end
Expand Down
56 changes: 47 additions & 9 deletions Bugsnag/Helpers/BSGInternalErrorReporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,57 @@ - (void)reportErrorWithClass:(NSString *)errorClass
}
}

- (void)reportException:(NSException *)exception
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash {
@try {
BugsnagEvent *event = [self eventWithException:exception diagnostics:diagnostics groupingHash:groupingHash];
if (event) {
[self sendEvent:event];
}
} @catch (NSException *exception) {
bsg_log_err(@"%@", exception);
}
}

// MARK: Private API

- (nullable BugsnagEvent *)eventWithErrorClass:(NSString *)errorClass
message:(nullable NSString *)message
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash {

NSArray<BugsnagStackframe *> *stacktrace = [BugsnagStackframe stackframesWithCallStackReturnAddresses:
BSGArraySubarrayFromIndex(NSThread.callStackReturnAddresses, 2)];

BugsnagError *error =
[[BugsnagError alloc] initWithErrorClass:errorClass
errorMessage:message
errorType:BSGErrorTypeCocoa
stacktrace:stacktrace];

return [self eventWithError:error diagnostics:diagnostics groupingHash:groupingHash];
}

- (nullable BugsnagEvent *)eventWithException:(NSException *)exception
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash {

NSArray<BugsnagStackframe *> *stacktrace = [BugsnagStackframe stackframesWithCallStackReturnAddresses:exception.callStackReturnAddresses];

BugsnagError *error =
[[BugsnagError alloc] initWithErrorClass:exception.name
errorMessage:exception.reason
errorType:BSGErrorTypeCocoa
stacktrace:stacktrace];

return [self eventWithError:error diagnostics:diagnostics groupingHash:groupingHash];
}

- (nullable BugsnagEvent *)eventWithError:(BugsnagError *)error
diagnostics:(nullable NSDictionary<NSString *, id> *)diagnostics
groupingHash:(nullable NSString *)groupingHash {

id<BSGInternalErrorReporterDataSource> dataSource = self.dataSource;
if (!dataSource) {
return nil;
Expand All @@ -101,15 +146,6 @@ - (nullable BugsnagEvent *)eventWithErrorClass:(NSString *)errorClass
}
[metadata addMetadata:dataSource.configuration.apiKey withKey:BSGKeyApiKey toSection:BugsnagDiagnosticsKey];

NSArray<BugsnagStackframe *> *stacktrace = [BugsnagStackframe stackframesWithCallStackReturnAddresses:
BSGArraySubarrayFromIndex(NSThread.callStackReturnAddresses, 2)];

BugsnagError *error =
[[BugsnagError alloc] initWithErrorClass:errorClass
errorMessage:message
errorType:BSGErrorTypeCocoa
stacktrace:stacktrace];

NSDictionary *systemInfo = [BSG_KSSystemInfo systemInfo];

BugsnagEvent *event =
Expand All @@ -128,6 +164,8 @@ - (nullable BugsnagEvent *)eventWithErrorClass:(NSString *)errorClass
return event;
}

// MARK: Delivery

- (NSURLRequest *)requestForEvent:(nonnull BugsnagEvent *)event error:(NSError * __autoreleasing *)errorPtr {
id<BSGInternalErrorReporterDataSource> dataSource = self.dataSource;
if (!dataSource) {
Expand Down
2 changes: 2 additions & 0 deletions Bugsnag/Helpers/BugsnagCollections.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ NSString * _Nullable BSGDeserializeString(id _Nullable rawValue);

NSDate * _Nullable BSGDeserializeDate(id _Nullable rawValue);

NSNumber * _Nullable BSGDeserializeNumber(id _Nullable rawValue);

NS_ASSUME_NONNULL_END
7 changes: 7 additions & 0 deletions Bugsnag/Helpers/BugsnagCollections.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,10 @@ id _Nullable BSGDeserializeArrayOfObjects(id _Nullable rawValue, id _Nullable (^
}
return [BSG_RFC3339DateTool dateFromString:(NSString *)rawValue];
}

NSNumber * _Nullable BSGDeserializeNumber(id _Nullable rawValue) {
if (![rawValue isKindOfClass:[NSNumber class]]) {
return nil;
}
return (NSNumber *)rawValue;
}
7 changes: 6 additions & 1 deletion Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,19 @@ bool bsg_ksmachgetThreadQueueName(const thread_t thread, char *const buffer,

thread_identifier_info_t idInfo = (thread_identifier_info_t)info;
dispatch_queue_t dispatch_queue = NULL;
uintptr_t junk = 0;
// thread_handle shouldn't be 0 also, because
// identifier_info->dispatch_qaddr = identifier_info->thread_handle +
// get_dispatchqueue_offset_from_proc(thread->task->bsd_info);
if (!idInfo->dispatch_qaddr || !idInfo->thread_handle ||
// sometimes the queue address is invalid, so avoid dereferencing
bsg_ksmachcopyMem((const void *)idInfo->dispatch_qaddr, &dispatch_queue,
sizeof(dispatch_queue)) != KERN_SUCCESS ||
!dispatch_queue) {
// Sometimes dispatch_queue is invalid which causes an EXC_BAD_ACCESS
// crash in dispatch_queue_get_label(). Check that dispatch_queue can
// be dereferenced to work around this.
bsg_ksmachcopyMem((const void *)dispatch_queue, &junk,
sizeof(junk)) != KERN_SUCCESS) {
BSG_KSLOG_TRACE(
"This thread doesn't have a dispatch queue attached : %p", thread);
return false;
Expand Down
22 changes: 6 additions & 16 deletions Bugsnag/Payload/BugsnagError.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,13 @@ - (instancetype)initWithErrorClass:(NSString *)errorClass
}

+ (BugsnagError *)errorFromJson:(NSDictionary *)json {
NSArray *trace = json[BSGKeyStacktrace];
NSMutableArray *data = [NSMutableArray new];

if (trace != nil) {
for (NSDictionary *dict in trace) {
BugsnagStackframe *frame = [BugsnagStackframe frameFromJson:dict];

if (frame != nil) {
[data addObject:frame];
}
}
}
BugsnagError *error = [[BugsnagError alloc] init];
error.errorClass = json[BSGKeyErrorClass];
error.errorMessage = json[BSGKeyMessage];
error.stacktrace = data;
error.typeString = json[BSGKeyType] ?: BSGErrorTypeStringCocoa;
error.errorClass = BSGDeserializeString(json[BSGKeyErrorClass]);
error.errorMessage = BSGDeserializeString(json[BSGKeyMessage]);
error.stacktrace = BSGDeserializeArrayOfObjects(json[BSGKeyStacktrace], ^id _Nullable(NSDictionary * _Nonnull dict) {
return [BugsnagStackframe frameFromJson:dict];
}) ?: @[];
error.typeString = BSGDeserializeString(json[BSGKeyType]) ?: BSGErrorTypeStringCocoa;
return error;
}

Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
#else
self.name = @"Bugsnag Objective-C";
#endif
self.version = @"6.10.0";
self.version = @"6.10.1";
self.url = @"https://github.com/bugsnag/bugsnag-cocoa";
self.dependencies = [NSMutableArray new];
}
Expand Down
7 changes: 7 additions & 0 deletions Bugsnag/Payload/BugsnagStackframe+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic) BOOL needsSymbolication;

// MARK: - Properties not used for Cocoa stack frames, but used by React Native and Unity.

@property (strong, nullable, nonatomic) NSNumber *columnNumber;
@property (copy, nullable, nonatomic) NSString *file;
@property (strong, nullable, nonatomic) NSNumber *inProject;
@property (strong, nullable, nonatomic) NSNumber *lineNumber;

@end

NS_ASSUME_NONNULL_END
36 changes: 12 additions & 24 deletions Bugsnag/Payload/BugsnagStackframe.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@
}


// MARK: - Properties not used for Cocoa stack frames, but used by React Native and Unity.

@interface BugsnagStackframe ()

@property (strong, nullable, nonatomic) NSNumber *columnNumber;
@property (copy, nullable, nonatomic) NSString *file;
@property (strong, nullable, nonatomic) NSNumber *inProject;
@property (strong, nullable, nonatomic) NSNumber *lineNumber;

@end


// MARK: -

@implementation BugsnagStackframe
Expand All @@ -49,26 +37,26 @@ + (NSDictionary *_Nullable)findImageAddr:(unsigned long)addr inImages:(NSArray *

+ (BugsnagStackframe *)frameFromJson:(NSDictionary *)json {
BugsnagStackframe *frame = [BugsnagStackframe new];
frame.machoFile = json[BSGKeyMachoFile];
frame.method = json[BSGKeyMethod];
frame.isPc = [json[BSGKeyIsPC] boolValue];
frame.isLr = [json[BSGKeyIsLR] boolValue];
frame.machoUuid = json[BSGKeyMachoUUID];
frame.machoFile = BSGDeserializeString(json[BSGKeyMachoFile]);
frame.method = BSGDeserializeString(json[BSGKeyMethod]);
frame.isPc = BSGDeserializeNumber(json[BSGKeyIsPC]).boolValue;
frame.isLr = BSGDeserializeNumber(json[BSGKeyIsLR]).boolValue;
frame.machoUuid = BSGDeserializeString(json[BSGKeyMachoUUID]);
frame.machoVmAddress = [self readInt:json key:BSGKeyMachoVMAddress];
frame.frameAddress = [self readInt:json key:BSGKeyFrameAddress];
frame.symbolAddress = [self readInt:json key:BSGKeySymbolAddr];
frame.machoLoadAddress = [self readInt:json key:BSGKeyMachoLoadAddr];
frame.type = json[BSGKeyType];
frame.columnNumber = json[@"columnNumber"];
frame.file = json[@"file"];
frame.inProject = json[@"inProject"];
frame.lineNumber = json[@"lineNumber"];
frame.type = BSGDeserializeString(json[BSGKeyType]);
frame.columnNumber = BSGDeserializeNumber(json[@"columnNumber"]);
frame.file = BSGDeserializeString(json[@"file"]);
frame.inProject = BSGDeserializeNumber(json[@"inProject"]);
frame.lineNumber = BSGDeserializeNumber(json[@"lineNumber"]);
return frame;
}

+ (NSNumber *)readInt:(NSDictionary *)json key:(NSString *)key {
NSString *obj = json[key];
if (obj) {
id obj = json[key];
if ([obj isKindOfClass:[NSString class]]) {
return @(strtoul([obj UTF8String], NULL, 16));
}
return nil;
Expand Down
Loading