Authored by 孟顺

crash 异常传递代码添加

review by 枪兵
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 17
18 #pragma mark - C Fuctions 18 #pragma mark - C Fuctions
19 19
  20 +static NSUncaughtExceptionHandler *YH_CrashReporter_Exception_Handler = NULL;
  21 +
20 @interface YH_CrashReporter() 22 @interface YH_CrashReporter()
21 23
22 - (NSString *)callstackString; 24 - (NSString *)callstackString;
@@ -72,6 +74,9 @@ void yh_uncaughtCrashExceptionHandler(NSException *exception) @@ -72,6 +74,9 @@ void yh_uncaughtCrashExceptionHandler(NSException *exception)
72 kYHEventReportTimeElapsed : currentTimestamp()?:@"" 74 kYHEventReportTimeElapsed : currentTimestamp()?:@""
73 }; 75 };
74 [crash performSelectorOnMainThread:@selector(handleNSException:) withObject:userInfo waitUntilDone:YES]; 76 [crash performSelectorOnMainThread:@selector(handleNSException:) withObject:userInfo waitUntilDone:YES];
  77 + if (YH_CrashReporter_Exception_Handler != NULL) {
  78 + YH_CrashReporter_Exception_Handler(exception);
  79 + }
75 } 80 }
76 81
77 @implementation YH_CrashReporter 82 @implementation YH_CrashReporter
@@ -99,7 +104,7 @@ void yh_uncaughtCrashExceptionHandler(NSException *exception) @@ -99,7 +104,7 @@ void yh_uncaughtCrashExceptionHandler(NSException *exception)
99 signal(SIGILL, yh_sighandler); 104 signal(SIGILL, yh_sighandler);
100 signal(SIGPIPE, yh_sighandler); 105 signal(SIGPIPE, yh_sighandler);
101 signal(SIGSEGV, yh_sighandler); 106 signal(SIGSEGV, yh_sighandler);
102 - 107 + YH_CrashReporter_Exception_Handler = NSGetUncaughtExceptionHandler();
103 NSSetUncaughtExceptionHandler(&yh_uncaughtCrashExceptionHandler); 108 NSSetUncaughtExceptionHandler(&yh_uncaughtCrashExceptionHandler);
104 } 109 }
105 110