Last active
August 15, 2023 09:32
-
-
Save drewmccormack/44e6511b3a96c53cdbc3cc9e358f7ab6 to your computer and use it in GitHub Desktop.
Symbolicates a sample dump from Activity Monitor
This file contains 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 | |
# | |
# To use this, just put the DSYMS in the same directory as the sample dump file, | |
# and run the script from that directory, passing the sample dump file name as only argument | |
# | |
import re, sys, os, subprocess | |
sampleFile = sys.argv[1] | |
for sampleLine in open(sampleFile, 'r').readlines(): | |
match = re.search(r'\?{3}\s*\(in\s+(.*?)\)\s+load address\s*([\d\w]+).*\[([\d\w]+)\]', sampleLine) | |
if match: | |
binary = match.group(1) | |
loadAddress = match.group(2) | |
offset = match.group(3) | |
script = "atos -arch x86_64 -o {0}.*.dSYM/Contents/Resources/DWARF/{1} -l {2} {3} > temp".format(binary, binary, loadAddress, offset) | |
os.system(script) | |
method = open('temp', 'r').read() | |
sampleLine = sampleLine.replace(r'???', method) | |
print sampleLine, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are on macOS Sonoma, there is a symbolicate button in Sample window. You can symbolicate the sample from there.