Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PLCrashReporter - How to symbolicate crash data in-process?

Is there a way to symbolicate the crash reports after we get the crash data?

Currently, this is what I'm doing in handleCrashReport method;

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);
        }

    }

When i print this out on console; I get this.

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

I want to symbolicate in-process If this is possible. Any ideas?

Thanks much in advance.

like image 840
ilker Acar Avatar asked Aug 05 '12 05:08

ilker Acar


People also ask

How do you Symbolicate a crash report?

To symbolicate in Xcode, click the Device Logs button in the Devices and Simulators window, then drag and drop the crash report file into the list of device logs. Crash reports must have the . crash file extension.

What is Symbolicate?

Symbolication is the process of converting them into human readable, class/method names, file names, and line numbers.


1 Answers

You can symbolicate the crash report in process, this requires three things:

  1. You should do that on then next app start only.
  2. You need the app symbols to be part of the binary, which increases its size by 30-50%
  3. You will not get line numbers.

The latest version of PLCrashReporter is able to do that, but I would not recommend it and rather symbolicate it using the dSYM because it is way more helpful.

like image 76
Kerni Avatar answered Dec 27 '22 12:12

Kerni