During beta testing of [Loopy Pro](https://loopypro.com), a tester had the misfortune to come across a hang-on-launch bug of the “exhausted real (wall clock) time allowance” kind that I couldn’t reproduce at all.
Annoyingly, when that happens, iOS often produces an unusable “ips” crash log which doesn’t at all resemble the normal, symbolicate-able kind – it’s pretty much just bunch of JSON with very little helpful content.
I got desperate, and wrote a parser to convert that JSON log into the normal kind, which can be symbolicated by the tool provided by Apple (which lives at /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash, by the way).
It’s just a quick-and-dirty PHP script, but it does the job, and I was finally able to see what was happening during the hang.
Here it is:
8badfood.php
#!/usr/local/bin/php <?php $file = file_get_contents("php://stdin"); $file = strstr($file, "\n"); $data = json_decode($file); $images = $data->usedImages; $header=<<<EOF Incident Identifier: $data->incident CrashReporter Key: $data->incident Hardware Model: $data->modelCode Process: $data->procName [$data->pid] Path: $data->procPath Identifier: {$data->bundleInfo->CFBundleIdentifier} Version: {$data->bundleInfo->CFBundleShortVersionString} ({$data->bundleInfo->CFBundleVersion}) Code Type: $data->cpuType (Native) Role: $data->procRole Parent Process: $data->parentProc [$data->parentPid] Coalition: $data->coalitionName [$data->pid] Date/Time: $data->captureTime Launch Time: $data->procLaunch OS Version: {$data->osVersion->train} ({$data->osVersion->build}) Release Type: {$data->osVersion->releaseType} Report Version: 104 EOF; echo $header; echo "\n" . join("\n", $data->termination->reasons) . "\n\n"; foreach ( $data->threads as $index => $thread ) { if ( isset($thread->queue) ) printf("Thread %d name: %s\n", $index, "Dispatch Queue: ".$thread->queue); printf("Thread %d:\n", $index); foreach ( $thread->frames as $index => $frame ) { $image = $images[$frame->imageIndex]; $symbol = isset($frame->symbol) ? $frame->symbol." + ".$frame->symbolLocation : sprintf("0x%08x + %d", $image->base, $frame->imageOffset); printf("%-4d %-38s0x%08x %s\n", $index, $image->name, $image->base+$frame->imageOffset, $symbol); } echo "\n"; } echo "Binary Images:\n"; foreach ( $images as $image ) { printf(" 0x%08x - 0x%08x %s %s <%s> %s\n", $image->base, $image->base+$image->size-1, $image->name, $image->arch, str_replace("-", "", $image->uuid), $image->path); } echo "\nEOF\n\n"; ?> |