It’s never good when an app crashes, but when it does you want to be able to figure out what went wrong. New Relic has powerful Crash Analysis capabilities to help dive into crash data. We also have a few helpful tips posted under Mobile Level-Up.
What if I want to symbolicate my crash locally?
Apple provides a Perl script with Xcode to symbolicate crash reports. There are just a few steps to set this up for quick and easy use. The script searches the machine for dSYMs that match the build uuid of the crash and symbolicates the crash against those dSYMs.
symbolicatecrash
description:
# It finds symbol-rich binaries by:
# a) searching in Spotlight to find .dSYM files by UUID, then finding the executable from there.
# That finds the symbols for binaries that a developer has built with "DWARF with dSYM File".
# b) searching in various SDK directories.
Let’s set this thing up!
First we need to find the symbolicatecrash
Perl script on your computer. Open the terminal app and use the find
command.
find /Applications/Xcode.app -name symbolicatecrash -type f
To simplify using this script let’s create an alias.
alias symbolicatecrash=<location_of_symbolicatecrash>
You’ll also need to export the following environment value.
export DEVELOPER_DIR='/Applications/Xcode.app/Contents/Developer'
To use this again later add the alias
and export
lines to your ~/.bash_profile
file.
How do I download a crash report?
While viewing a crash detail page in Crash Analysis there is a link just above the stack trace to Export crash details. Save this somewhere easy to get to later.
Alright, now how do I use it?
Simple, just run symbolicatecrash crashreport.txt
Of course there’s more you can do with this script. Since it uses Spotlight search to look for dSYMs that match the build uuid the above will typically symbolicate the crash. You probably want to output this to a file or maybe pass a specific dSYM file or get a verbose output. For all of these refer to the usage information from symbolicatecrash --help
usage: $0 [--help] [--dsym=DSYM] [--output OUTPUT_FILE] [SYMBOL_PATH ...] The crash log to be symbolicated. If "-", then the log will be read from stdin Additional search paths in which to search for symbol rich binaries -o | --output The symbolicated log will be written to OUTPUT_FILE. Defaults to "-" (i.e. stdout) if not specified -d | --dsym Adds additional dSYM that will be consulted if and when a binary's UUID matches (may be specified more than once) -h | --help Display this help message -v | --verbose Enables additional output
Now what?
Do a dance? Get a coffee? I don’t know, this is your time!