Disable crash reporter plugin for iOS and update callstack from array to string

Summary:
This diff does the following

- Comments out the code in iOS which sends the message to the desktop side
- Also comments out the part where signal handler is initialised, as we no longer need it. I will remove the iOS implementation completely in next few diffs
- Updated the JS side to expect call stack as a string instead of an array
- Updated the android side to send callstack as a string

I have commented out the code for crash reporter plugin of iOS as for iOS I will be adding a watchman  to a directory where crash logs are dumped. The diff related to this is in the stack

Reviewed By: passy

Differential Revision: D13424824

fbshipit-source-id: b1105da912292bf73cff948206c031de9b059abd
This commit is contained in:
Pritesh Nandgaonkar
2018-12-18 13:30:49 -08:00
committed by Facebook Github Bot
parent 73e921bafc
commit e3fb1e1d84
3 changed files with 15 additions and 45 deletions

View File

@@ -16,16 +16,8 @@
@property (assign, nonatomic) NSUInteger notificationID;
@property (assign, nonatomic) NSUncaughtExceptionHandler *prevHandler;
- (void) handleException:(NSException *)exception;
@end
static void flipperkitUncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
[[FlipperKitCrashReporterPlugin sharedInstance] handleException:exception];
}
@implementation FlipperKitCrashReporterPlugin {
std::unique_ptr<facebook::flipper::FlipperKitSignalHandler> _signalHandler;
folly::ScopedEventBaseThread _crashReporterThread;
@@ -55,30 +47,16 @@ static void flipperkitUncaughtExceptionHandler(NSException *exception) {
return @"CrashReporter";
}
- (void) handleException:(NSException *)exception {
// TODO: Rather than having indirection from c function, somehow pass objective c selectors as a c function pointer to NSSetUncaughtExceptionHandler
self.notificationID += 1;
[self.connection send:@"crash-report" withParams:@{@"reason": [exception reason], @"name": [exception name], @"callstack": [exception callStackSymbols]}];
if (self.prevHandler) {
self.prevHandler(exception);
}
}
- (void)sendCrashParams:(NSDictionary *)params {
self.notificationID += 1;
[self.connection send:@"crash-report" withParams: params];
}
- (void)didConnect:(id<FlipperConnection>)connection {
self.connection = connection;
_signalHandler = std::make_unique<facebook::flipper::FlipperKitSignalHandler>(self, _crashReporterThread.getEventBase());
NSSetUncaughtExceptionHandler(&flipperkitUncaughtExceptionHandler);
}
- (void)didDisconnect {
self.connection = nil;
_signalHandler.reset(nullptr); // deallocate the object
NSSetUncaughtExceptionHandler(self.prevHandler);
}
- (BOOL)runInBackground {