-->

PLCrashReporter - 如何symbolicate过程中的碰撞数据?(PLCrashR

2019-09-20 20:10发布

有没有一种方法来symbolicate崩溃报告中,我们得到了碰撞数据后?

目前,这是我在handleCrashReport方法正在做的;

PLCrashReportTextFormat textFormat = PLCrashReportTextFormatiOS;

    /* Decode data */

    PLCrashReport *crashLog = [[PLCrashReport alloc] initWithData: data error: &error];
    if (crashLog == nil) {
        NSLog(@"Could not decode crash file :%@",  [[error localizedDescription] UTF8String]);
    } else {
        NSString* report = [PLCrashReportTextFormatter stringValueForCrashReport: crashLog withTextFormat: textFormat];
        NSLog(@"Crash log \n\n\n%@ \n\n\n", report);

        NSString *outputPath = [documentsDirectory stringByAppendingPathComponent: @"app.crash"];
        if (![report writeToFile:outputPath atomically:YES encoding:NSUTF8StringEncoding error:nil]) {
            NSLog(@"Failed to write crash report");
        } else {
            NSLog(@"Saved crash report to: %@", outputPath);
        }

    }

当我打印出来控制台上; 我得到这个。

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This should crash the application.'

Thread 0 Crashed:
0   libsystem_kernel.dylib              0x93a0d9c6 0x939f5000 + 100806
1   libsystem_c.dylib                   0x9c5aabdd 0x9c55b000 + 326621
2   shell                               0x00082a2c 0x1000 + 530988
3   CoreFoundation                      0x0263d0fc 0x253f000 + 1040636
4   libobjc.A.dylib                     0x00f8ef0f 0xf89000 + 24335
5   libc++abi.dylib                     0x02a028de 0x29fd000 + 22750
6   libc++abi.dylib                     0x02a02946 0x29fd000 + 22854
7   libc++abi.dylib                     0x02a03b3e 0x29fd000 + 27454
8   libobjc.A.dylib                     0x00f8ee15 0xf89000 + 24085
9   CoreFoundation                      0x02573de0 0x253f000 + 216544
10  CoreFoundation                      0x02573c9b 0x253f000 + 216219
11  UIKit                               0x0150ac65 0x1501000 + 40037
12  UIKit                               0x0150c626 0x1501000 + 46630
13  shell                               0x00002fed 0x1000 + 8173
14  shell                               0x00001f95 0x1000 + 3989

Thread 1:
0   libsystem_kernel.dylib              0x93a0e90a 0x939f5000 + 104714
1   libdispatch.dylib                   0x02ad2be1 0x2ad1000 + 7137

Thread 2:
0   libsystem_kernel.dylib              0x93a0bc22 0x939f5000 + 93218
1   libsystem_notify.dylib              0x97cb9cd2 0x97cb8000 + 7378
2   libsystem_notify.dylib              0x97cbdb4b 0x97cb8000 + 23371
3   libsystem_c.dylib                   0x9c5e859b 0x9c55b000 + 578971
4   CoreFoundation                      0x025e61c3 0x253f000 + 684483
5   CoreFoundation                      0x025e5d83 0x253f000 + 683395
6   Foundation                          0x00caab53 0xc34000 + 486227
7   Foundation                          0x00caaac5 0xc34000 + 486085
8   shell                               0x003ddbf8 0x1000 + 4049912
9   libdispatch.dylib                   0x02ad2330 0x2ad1000 + 4912
10  libdispatch.dylib                   0x02ad3f0c 0x2ad1000 + 12044
11  libdispatch.dylib                   0x02ad3cb4 0x2ad1000 + 11444
12  libdispatch.dylib                   0x02ad3402 0x2ad1000 + 9218
13  libsystem_c.dylib                   0x9c5b9b24 0x9c55b000 + 387876
14  libsystem_c.dylib                   0x9c5bb6fe 0x9c55b000 + 395006

我想在-过程symbolicate如果这是可能的。 有任何想法吗?

感谢很多提前。

Answer 1:

您可以在symbolicate过程中崩溃报告,这需要三件事情:

  1. 你应该做的是对未来再启动的应用程序只。
  2. 你需要的应用程序的符号是二进制的,其中30-50%,增加其大小的一部分
  3. 你不会得到行号。

PLCrashReporter的最新版本是能够做到这一点,但我不会推荐它,而使用的dSYM因为这样更有利于symbolicate它。



Answer 2:

PLCrashReporter提供配置选项symbolicate在设备上

  PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] initWithSignalHandlerType: PLCrashReporterSignalHandlerTypeBSD symbolicationStrategy: PLCrashReporterSymbolicationStrategyAll];
PLCrashReporter *crashReporter = [[PLCrashReporter alloc] initWithConfiguration:config];

然而,有2个原因symbolication与DSYM更好:

  • 该文件建议不使用此功能的发布版本
  • 该symbolication不像一个使用DSYM和系统架构的调试符号一样好。 你会得到很多的'行。

要symbolicate在开发机器上崩溃报告,你可以这样做(确保原始二进制和DSYM文件在同一目录,你必须在崩溃报告中提到的IOS版本的调试符号):

/Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash MyCrash.crash


文章来源: PLCrashReporter - How to symbolicate crash data in-process?