Created
September 23, 2020 09:57
-
-
Save havchr/e05b2b30443b51037f0dbd84dc7c26b9 to your computer and use it in GitHub Desktop.
A small script to symbolicate an iOS-crashlog by parsing a bit and using the atos command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import subprocess | |
print("use like this... ./megasymbo.py unsymbolicated.crash YourThing.dSYM/Contents/Resources/DWARF/YourThing YourThing > result.crash") | |
print("third argument is for the pattern of YourThing 0xbadf00d 0x1337") | |
if len(sys.argv) != 4: | |
print("Exiting program.. Please provide exact arguments") | |
quit() | |
thaCrash = sys.argv[1] | |
thaDSym = sys.argv[2] | |
thaLinePattern = sys.argv[3] | |
atosCommand = "/usr/bin/atos -arch arm64 -o {} -l ".format(thaDSym) | |
with open(thaCrash) as fp: | |
for cnt,line in enumerate(fp): | |
if thaLinePattern in line: | |
themAdds = [word for word in line.split() if word.startswith("0x")] | |
if len(themAdds) >= 2: | |
atosRealCommand = "{} {} {}".format(atosCommand,themAdds[1],themAdds[0]) | |
ans = subprocess.check_output(atosRealCommand,shell=True) | |
print(line +" "+ ans) | |
else: | |
sys.stdout.write(line) | |
else: | |
sys.stdout.write(line) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment