Skip to content

Instantly share code, notes, and snippets.

@tluyben
Created August 1, 2014 11:49
Show Gist options
  • Save tluyben/76ae8c74736fa47b33a4 to your computer and use it in GitHub Desktop.
Save tluyben/76ae8c74736fa47b33a4 to your computer and use it in GitHub Desktop.
Get crash reports with symbols for iOS
#!/usr/bin/python
import sys
import os.path
import re
import subprocess
if len(sys.argv) < 4:
print "Usuage: ./getcrash.py AppName AppSymbol crashlog.ips"
print "Where AppName is the iOS app name without .app, AppSymbol the app name in the logs (usually almost the same as the AppName and the crash log file."
sys.exit()
app = sys.argv[1]
symb = sys.argv[2]
log = sys.argv[3]
if not os.path.exists(app + ".app"):
print app + ".app does not exist or cannot be read."
sys.exit()
if not os.path.exists(app + ".app.dSYM"):
print app + ".app.dSYM does not exist or cannot be read."
sys.exit()
if not os.path.exists(log):
print log + " log file does not exist."
sys.exit()
with open(log) as f:
for l in f:
m = re.match(r"\d\d*\s+"+symb+"\s+(0x\w+)\s.*", l)
if m:
command = ["atos", "-arch", "armv7", "-o", app+".app/"+symb, m.group(1)]
p = subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
for l1 in iter(p.stdout.readline, b''):
if symb in l1:
print l1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment