问题
My iOS application crashed. I would like to read the crash log with the dSYM file. How is it possible?
回答1:
First of all, you need three files: the dSYM file, the application file and the crash log.
Open the X Code, in the project navigator reveal the Products folder, and "Show in finder" the app file. Here you will find the dSYM file too. Copy them to a folder.
Now open the terminal, and navigate to the folder you copied previously the two files. Run: dwarfdump --uuid Application_name.app/Application_name
You should receive the application's UUID.
Run the following command: dwarfdump --uuid Application_name.app.dSYM
- you will receive the UUID again, which should match the previously received UUID.
Open the crash log (X Code - Organizer - crashes), and find the line where appears the "Binary images" title. Here is another UUID in the first line, which should match again with the previously received in the terminal.
Now, you are assured the crash was logged in the build you are examining, so open again the crash log file, find the Thread 0 section, and there should be two lines with your application name and two addresses. Such as:
Application_name 0x123456
Application_name 0x987654
In the terminal you should run now: atos -arch armv7 -o address1 address2
(the address1 and address2 should be replaced with the previous two addresses, and the armv7 with your system's - it is shown at the lines, where you got the UUIDs).
Happy debugging!
EDIT: I would like to mention this post as base of mine.
回答2:
Actually, you can't decode the dSYM file, but get the error detail from it
1. find the crash thread and address from log file:following is 0x0nnn
2. find the native Code Type from log file: following is arm64
3. find the dSYM file(symbol file),extract from .xcarchive: following is xx.app.dSYM
dwarfdump --lookup 0x0nnn --arch=[arm64 armv6 armv7] xx.app.dSYM
回答3:
Inspiration
https://developer.apple.com/library/archive/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATEWITHXCODE
Steps to get a dsym file
- Build the iOS app for Archive
- Extract the MyApp.xcarchive
- Inside that file, you will find your dSYM file.
Get your device crash log
Pull the .crash file off a device. I normally use xCode for this.
Line-by-line method
atos -arch arm64 -o TheElements.app.dSYM/Contents/Resources/DWARF/TheElements -l 0x1000e4000 0x00000001000effdc
0x1000e4000 = address of your app's image
0x00000001000effdc = is the stripped name of the symbol you want to turn into a readable name
Pro method
Get the location of symbolicatecrash
executable.
In xCode 9, the file you want is here:
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash
Print symbolicated crash log to terminal
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
./symbolicatecrash -v crash_log_20_9_2018.crash myapp.app.dSYM
Reading
Nice instructions for atos
here:
How to symbolicate crash log Xcode?
Way to perform the same without the dsym file here: https://medium.com/@Mrugraj/crash-re-symbolication-5c28d3a3a883
来源:https://stackoverflow.com/questions/11883069/how-to-decode-a-crash-log-using-dsym-file-in-ios