-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Crashlytics add new Record Exception Model API (#5055)
- Loading branch information
Showing
32 changed files
with
699 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2020 Google | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#import "FIRExceptionModel.h" | ||
|
||
@interface FIRExceptionModel () | ||
|
||
@property(nonatomic, copy) NSString *name; | ||
@property(nonatomic, copy) NSString *reason; | ||
|
||
@end | ||
|
||
@implementation FIRExceptionModel | ||
|
||
- (instancetype)initWithName:(NSString *)name reason:(NSString *)reason { | ||
self = [super init]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_name = [name copy]; | ||
_reason = [reason copy]; | ||
|
||
return self; | ||
} | ||
|
||
+ (instancetype)exceptionModelWithName:(NSString *)name reason:(NSString *)reason { | ||
return [[FIRExceptionModel alloc] initWithName:name reason:reason]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// Copyright 2020 Google | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#import "FIRStackFrame_Private.h" | ||
|
||
@interface FIRStackFrame () | ||
|
||
@property(nonatomic, copy, nullable) NSString *symbol; | ||
@property(nonatomic, copy, nullable) NSString *rawSymbol; | ||
@property(nonatomic, copy, nullable) NSString *library; | ||
@property(nonatomic, copy, nullable) NSString *fileName; | ||
@property(nonatomic, assign) uint32_t lineNumber; | ||
@property(nonatomic, assign) uint64_t offset; | ||
@property(nonatomic, assign) uint64_t address; | ||
|
||
@property(nonatomic, assign) BOOL isSymbolicated; | ||
|
||
@end | ||
|
||
@implementation FIRStackFrame | ||
|
||
#pragma mark - Public Methods | ||
|
||
- (instancetype)initWithSymbol:(NSString *)symbol file:(NSString *)file line:(NSInteger)line { | ||
self = [super init]; | ||
if (!self) { | ||
return nil; | ||
} | ||
|
||
_symbol = [symbol copy]; | ||
_fileName = [file copy]; | ||
_lineNumber = (uint32_t)line; | ||
|
||
_isSymbolicated = true; | ||
|
||
return self; | ||
} | ||
|
||
+ (instancetype)stackFrameWithSymbol:(NSString *)symbol file:(NSString *)file line:(NSInteger)line { | ||
return [[FIRStackFrame alloc] initWithSymbol:symbol file:file line:line]; | ||
} | ||
|
||
#pragma mark - Internal Methods | ||
|
||
+ (instancetype)stackFrame { | ||
return [[self alloc] init]; | ||
} | ||
|
||
+ (instancetype)stackFrameWithAddress:(NSUInteger)address { | ||
FIRStackFrame *frame = [self stackFrame]; | ||
|
||
[frame setAddress:address]; | ||
|
||
return frame; | ||
} | ||
|
||
+ (instancetype)stackFrameWithSymbol:(NSString *)symbol { | ||
FIRStackFrame *frame = [self stackFrame]; | ||
|
||
frame.symbol = symbol; | ||
frame.rawSymbol = symbol; | ||
|
||
return frame; | ||
} | ||
|
||
#pragma mark - Overrides | ||
|
||
- (NSString *)description { | ||
if (self.isSymbolicated) { | ||
return [NSString | ||
stringWithFormat:@"{%@ - %@:%u}", [self fileName], [self symbol], [self lineNumber]]; | ||
} | ||
|
||
if (self.fileName) { | ||
return [NSString stringWithFormat:@"{[0x%llx] %@ - %@:%u}", [self address], [self fileName], | ||
[self symbol], [self lineNumber]]; | ||
} | ||
|
||
return [NSString | ||
stringWithFormat:@"{[0x%llx + %u] %@}", [self address], [self lineNumber], [self symbol]]; | ||
} | ||
|
||
@end |
Oops, something went wrong.