Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decode a Crash log using dSYM file in iOS?

Tags:

My iOS application crashed. I would like to read the crash log with the dSYM file. How is it possible?

like image 341
MMMM Avatar asked Aug 09 '12 12:08

MMMM


People also ask

What is dSYM file in iOS?

A dSYM file is an ELF file that contains DWARF (debugging with attributed record formats) debug information for your application. DWARF is a debugging file format that supports source-level debugging.


2 Answers

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.

like image 130
MMMM Avatar answered Sep 19 '22 14:09

MMMM


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

like image 35
rustyMagnet Avatar answered Sep 17 '22 14:09

rustyMagnet