Analysing iPhone crash log
I got a crash log from a customer using my iPhone app and trying to get symbolic information out of, and failing spectacularly ... what I found online as instruction is this (to be executed on a Mac):
symbolicatecrash crash-log-file.crash symbol-file.dSYM > report-with-symbols.crash
- crash-log-file.crash is the crash log obtained by the user via iTunes, a text file
- symbol-file.dSYM is created by XCode each time you build the application and contains t开发者_如何学运维he symbols file (within a series of folders)
Unfortunately my attempts have all failed: - with a version of symbolicatecrash I have (don't recall where & when I found it), the output is identical to the input file, without symbols - with another version I found on my disk, I get this error message (note: I tried to point to the symbol file itself within the .dSYM tree - still no help):
/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash failedstart.crash ScanBizCards.app.dSYM/Contents/Resources/DWARF/ScanBizCards > crashwithsymbols
Can't understand the output from otool ( -> '\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/usr\/bin\/otool -arch armv7 -l /Users/patrickq/Projects/icr/OCR/newOCR/build/Debug-iphonesimulator/ScanBizCards.app/ScanBizCards') at /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash line 301.
Help anyone?
I don't even mind doing the math myself for symbols but don't know how to open the symbols file ...
Patrick
symbolicatecrash
is very buggy and try to do smart things to locate your binaries/dsym files using spotlight (mdfind
). This line is the clue:
Can't understand the output from otool
( -> '\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/usr\/bin\/otool
-arch armv7 -l
/.../build/Debug-iphonesimulator/ScanBizCards.app/ScanBizCards')
Apparently, it found one of your developement build product (for the simulator) and used it to try to symbolicate a crashreport generated on the device. And it failed miserably, of course.
The exact same problem occurred to two different people at our company. I haven't investigated how the problem happens. I imagine this is quite rare, otherwise, such an enormous bug would have already been fixed. For the moment, I have only this very crude workaround:
- Remove all your
build
folder mentioning this executable name (in your caseScanBizCards.app
) - Remove the application from the simulator (I mean, all the incarnations of the application in the various versions of the simulator, like in
~/Library/Application Support/iPhone Simulator/4.3
,~/Library/Application Support/iPhone Simulator/3.2
, ...)
This leaves you with the archived applications only. This time, symbolicatecrash
can't find a wrong version and eventually find the correct one.
If I ever reproduce the problem, I will take some time to debug this horrible perl script.
I hope that helps.
I have the same issue pointed out by Frederic. To more completely fix the issue, search for sub getSymbolPathFor_dsymUuid
in the symbolicatecrash
script, and change the following line:
my $cmd = "mdfind \"com_apple_xcode_dsym_uuids == $myuuid\"";
Add this parameter after mdfind
:
-onlyin /path/to/your/app/bundles
and use the directory where you are storing your archived bundles. This way, it will always find the correct version of your app. If you want to be extra safe, scroll down a bit to where it says:
my @spotLightSearchForExecutable = `mdfind $executable.app'; # To cover the case where the DSYM's and .app are no located in the same location.
And add the -onlyin /path/to/your/app/bundles
as well. This path is only used when, as the comment on the above line states, symbolicatecrash
cannot find your .app in the same folder as your .DSYM. Hopefully, if you store them both in the same folder, this should never be run, but if you have any doubts, it's better to be safe and do this too.
It seems that you are running symbolicatecrash for iPhone simulator debug symbols, while you need to pass the path to symbols for iPhone device build
If you use the "Build and Archive" feature from Xcode to distribute the app (to Apple Store or the user), you can drag the crash log to the organizer and let the IDE do symbolication.
Remember, you must have the exact version of the app and .DSYM. Recompiling the app generates a different .DSYM and it will not work.
精彩评论