New tool: The Symbolicator
Sunday, April 19th, 2009The most significant behind-the-scenes change in Growl 1.1.5 is that we now build using the DWARF-with-dSYM debug symbol format.
Now, we distribute a fully-stripped executable for every release—even betas—and we keep the dSYM bundles on hand separately. The idea here is that we can use the dSYM bundles to obtain symbolic information (function name, filename, and line number) for the bare addresses in users’ crash logs.
Unfortunately, there are no good tools for symbolicating Mac OS X crash logs. If this were an iPhone app, we could just drag the crash logs into the Xcode Organizer window, but Xcode doesn’t do this for Mac crash logs.
I tried all the other tools as well, and every one of them had one of two problems:
- Didn’t work at all
- Needed the dSYM bundle and main bundle to be next to each other on disk
#2 is not a deal-breaker, but it is a hassle.
So I wrote my own symbolication tool.
The Symbolicator is a Python script that:
- Reads in a crash log.
- Finds the necessary dSYM bundles using Spotlight. (This means that you can put the dSYM bundles anywhere you want, and as long as Spotlight can find them, the Symbolicator will be able to use them.)
- Uses dwarfdump to extract the relevant symbol information.
- Replaces the address offsets with the symbol information (just like CrashReporter does when it has debug symbols to work with).
- Writes the symbolicated log to stdout.
Use it like this:
% symbolicator < unsymbolicated.crash > symbolicated.crash
Or use ThisService to make a service out of it.
If you want to see it in action right now, download Growl 1.1.5b1 and the corresponding dSYM bundles from the Growl beta page. Make Growl crash (killall -TRAP works well), then unpack the bundles and use the Symbolicator on the crash log. (If you unpack the bundles first, CrashReporter will symbolicate the log before you even get to it. Handy, unless you’re trying to test the Symbolicator. ☺)
To make this work on your own app, follow the instructions in the aforementioned ADC article, then make sure you archive the dSYM bundles for every release, including betas. On Growl, I added code to our Release Makefile for this.
Note: If your app is closed-source, you should not put your dSYM bundles on your website, since the debug symbols are arguably trade secrets (information about your source code). Keep them locally, perhaps on a flash-memory drive. Disclaimer: IANAL.