Skip to content

Instantly share code, notes, and snippets.

@dlo
Created December 20, 2012 04:42
Show Gist options
  • Save dlo/4343005 to your computer and use it in GitHub Desktop.
Save dlo/4343005 to your computer and use it in GitHub Desktop.
Apple Crash Report Cleanup Script

A lot of the time, crash reports sent via email get a bit garbled over the wire, and Xcode won't symbolicate them. It turns out that a lot of email clients (including Apple Mail) are the cause of this.

This script takes a crash report and cleans it up so that Xcode likes it.

Usage:

$ cat example.crash | cleanup.py
<spews out goodness>
#!/usr/bin/python
import sys
import re
hexline = re.compile(r'0x[a-f0-9]{5,8} - 0x[a-f0-9]{5,8}')
buffer = ""
for line in sys.stdin:
if hexline.match(line):
print buffer.replace('\n', '')
buffer = line
continue
if buffer:
buffer += line
continue
print line,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment