I have received a few crash reports from users of my app; however, they are in KSCrash's JSON format. I can tell what the problem is but I can find exactly where the problem is! Everything I can find to symbolicate the crash report seems to deal with Apple style report and not a lot on KSCrash's JSON format.
Symbolicating iPhone App Crash Reports doesn't seem to support the JSON format.
I have also tried atos (i.e., from Using atos to determine crashed method name with dSYM but not sure if I am correctly calculating the addresses correctly.
Please help!
JSON Crash Report:
{
"binary_images": [
{
"cpu_subtype": 0,
"cpu_type": 16777228,
"image_addr": 4295196672,
"image_size": 524288,
"image_vmaddr": 4294967296,
"name": "/var/mobile/Containers/Bundle/Application/5CEB5AA5-797A-4656-8E41-E3898243DD2C/MYAPP.app/MYAPP",
"uuid": "C34AC6E9-4A70-3909-89E3-B7621BAC1855"
},
...
{
"cpu_subtype": 0,
"cpu_type": 16777228,
"image_addr": 6627819520,
"image_size": 151552,
"image_vmaddr": 6625312768,
"name": "/System/Library/PrivateFrameworks/CoreServicesInternal.framework/CoreServicesInternal",
"uuid": "69F0DA76-836A-3F05-BCF8-A561EC6C467A"
}
],
"crash": {
"diagnosis": "Application threw exception NSInvalidArgumentException: (null)\nOriginated at or in a subcall of _mh_execute_header",
"error": {
"address": 0,
"mach": {
"code": 0,
"exception": 10,
"exception_name": "EXC_CRASH",
"subcode": 0
},
"nsexception": {
"name": "NSInvalidArgumentException",
"referenced_object": {
"address": 5896109504,
"type": "unknown"
}
},
"reason": "-[NSKnownKeysDictionary1 floatValue]: unrecognized selector sent to instance 0x15f6f7dc0",
"signal": {
"code": 0,
"name": "SIGABRT",
"signal": 6
},
"type": "nsexception"
},
"threads": [
{
"backtrace": {
"contents": [
{
"instruction_addr": 6480478100,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480477976,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6826131244,
"object_addr": 6826098688,
"object_name": "libobjc.A.dylib",
"symbol_addr": 6826131188,
"symbol_name": "objc_exception_throw"
},
{
"instruction_addr": 6480506028,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480505816,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6480493644,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480492772,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6479458908,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6479458816,
"symbol_name": "_CF_forwarding_prep_0"
},
{
"instruction_addr": 4295494968,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 4295426364,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 4295392188,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 4295384932,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 4295385280,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 6570714364,
"object_addr": 6570655744,
"object_name": "UIKit",
"symbol_addr": 6570713740,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562573572,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562573424,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562552096,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562551804,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562551776,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562551744,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562549376,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562549124,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562548692,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562548176,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6562521932,
"object_addr": 6562512896,
"object_name": "QuartzCore",
"symbol_addr": 6562521852,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6480179012,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480178980,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6480170172,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480169800,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6480171244,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6480170316,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6479304704,
"object_addr": 6479265792,
"object_name": "CoreFoundation",
"symbol_addr": 6479304320,
"symbol_name": "CFRunLoopRunSpecific"
},
{
"instruction_addr": 6664434032,
"object_addr": 6664388608,
"object_name": "GraphicsServices",
"symbol_addr": 6664433852,
"symbol_name": "GSEventRunModal"
},
{
"instruction_addr": 6571156968,
"object_addr": 6570655744,
"object_name": "UIKit",
"symbol_addr": 6571156764,
"symbol_name": "UIApplicationMain"
},
{
"instruction_addr": 4295322808,
"object_addr": 4295196672,
"object_name": "MYAPP",
"symbol_addr": 4295196672,
"symbol_name": "_mh_execute_header"
},
{
"instruction_addr": 6834759864,
"object_addr": 6834749440,
"object_name": "libdyld.dylib",
"symbol_addr": 6834759860,
"symbol_name": "<redacted>"
}
],
"skipped": 0
},
"crashed": true,
"current_thread": true,
"index": 0
},
{
"backtrace": {
"contents": [
{
"instruction_addr": 6835930524,
"object_addr": 6835814400,
"object_name": "libsystem_kernel.dylib",
"symbol_addr": 6835930516,
"symbol_name": "kevent_qos"
},
{
"instruction_addr": 6834634084,
"object_addr": 6834552832,
"object_name": "libdispatch.dylib",
"symbol_addr": 6834633852,
"symbol_name": "<redacted>"
},
{
"instruction_addr": 6834566092,
"object_addr": 6834552832,
"object_name": "libdispatch.dylib",
"symbol_addr": 6834566040,
"symbol_name": "<redacted>"
}
],
"skipped": 0
},
"crashed": false,
"current_thread": false,
"index": 1,
"registers": {
"basic": {
"cpsr": 0,
"fp": 6140552752,
"lr": 6834634084,
"pc": 6835930524,
"sp": 6140552608,
"x0": 3,
"x1": 6944956928,
"x10": 0,
"x11": 0,
"x12": 24,
"x13": 33554431,
"x14": 0,
"x15": 5895038864,
"x16": 374,
"x17": 0,
"x18": 0,
"x19": 6944821248,
"x2": 1,
"x20": 6944821248,
"x21": 6944821248,
"x22": 6944956800,
"x23": 6944960512,
"x24": 6944960512,
"x25": 0,
"x26": 6140555520,
"x27": 6140555520,
"x28": 0,
"x29": 6140552752,
"x3": 6140552616,
"x4": 1,
"x5": 0,
"x6": 0,
"x7": 0,
"x8": 6944956864,
"x9": 0
}
}
},
...
]
},
"process": {},
"report": {
"id": "93239236-359A-44AC-8AAA-9AB2ACCE30DA",
"process_name": "MYAPP",
"timestamp": "2015-07-17T23:35:51Z",
"type": "standard",
"version": {
"major": 3,
"minor": 0
}
},
"system": {
"CFBundleExecutable": "MYAPP",
"CFBundleExecutablePath": "/var/mobile/Containers/Bundle/Application/5CEB5AA5-797A-4656-8E41-E3898243DD2C/MYAPP.app/MYAPP",
"CFBundleIdentifier": "ca.mymojo.CJ-Stats",
"CFBundleName": "MYAPP",
"CFBundleShortVersionString": "1.1.2",
"CFBundleVersion": "1.1.2",
"app_start_time": "2015-07-17T23:35:47Z",
"app_uuid": "C34AC6E9-4A70-3909-89E3-B7621BAC1855",
"application_stats": {
"active_time_since_last_crash": 3.93054,
"active_time_since_launch": 3.93054,
"application_active": true,
"application_in_foreground": true,
"background_time_since_last_crash": 0,
"background_time_since_launch": 0,
"launches_since_last_crash": 1,
"sessions_since_last_crash": 1,
"sessions_since_launch": 1
},
"binary_cpu_subtype": 0,
"binary_cpu_type": 16777228,
"boot_time": "2015-07-17T12:07:09Z",
"cpu_arch": "arm64",
"cpu_subtype": 1,
"cpu_type": 16777228,
"device_app_hash": "58ebd0a220c47528a58b7d2426b69ce4b5491e14",
"jailbroken": false,
"kernel_version": "Darwin Kernel Version 15.0.0: Mon Jun 29 00:33:05 PDT 2015; root:xnu-3247.1.36.0.1~9/RELEASE_ARM64_T7000",
"machine": "iPhone7,2",
"memory": {
"free": 27996160,
"size": 1035993088,
"usable": 825868288
},
"model": "N61AP",
"os_version": "13A4293g",
"parent_process_id": 1,
"parent_process_name": "unknown",
"process_id": 4791,
"process_name": "MYAPP",
"system_name": "iPhone OS",
"system_version": "9.0",
"time_zone": "CDT"
},
"user": {}
}
Finally figured it out!
I needed to use KSCrashReportFilterAppleFmt to convert the file to .crash file which then I could load into Xcode which happily symbolised it for me. The code I used to convert is below, if anyone else finds this useful.
NSString *srcFilePath = @"crash-report.json";
NSString *destFilePath = @"crash-report.crash";
NSData *myJSON = [NSData dataWithContentsOfFile:srcFilePath];
NSError* localError = nil;
NSDictionary *parsedJSON = [NSJSONSerialization JSONObjectWithData:myJSON options:0 error:&localError];
if(localError != nil)
{
return ;
}
id filter = [KSCrashReportFilterAppleFmt filterWithReportStyle:KSAppleReportStyleSymbolicatedSideBySide];
NSArray *reports = @[parsedJSON];
[filter filterReports:reports
onCompletion:^(NSArray *filteredReports, BOOL completed, NSError *error) {
if(error != nil) {
return;
}
if(completed) {
NSString *contents = [filteredReports objectAtIndex:0];
[contents writeToFile:destFilePath
atomically:YES
encoding:NSStringEncodingConversionAllowLossy
error:nil];
}
}];