Showing posts with label device crash logs. Show all posts
Showing posts with label device crash logs. Show all posts

Wednesday, March 9, 2016

Reading Crash Logs

This post will list the steps you need to take to read a crash log after receiving the crash log file.  This assumes you are using the same Xcode (6+) that you used to Archive the app.


  1. Connect your iOS device.
  2. Open Xcode
  3. In the menu, go to Window->Devices
  4. Select your iOS device and click on the View Device Logs button.
  5. Select the "All Logs" tab.
  6. If you crash log file does not have the .crash extension, rename it to have a .crash extension.
  7. Drag the file into the device's log window.  Specifically, the left column.
  8. Wait a minute or so until the list of logs shows the log you dragged in.
  9. When your log shows up, right-click on your log and select Re-Symbolicate Log.
  10. Once Re-Symbolicating is done you will have a readable crash log.
This information has been compiled from the Stack Overflow answer and comments:


Saturday, October 29, 2011

Using symbolicatecrash script to symbolicate crash logs

Update:  If this doesn't work for you anymore, try this:

http://iphoneidoit.blogspot.com/2016/03/reading-crash-logs.html

We were given a consulting job to figure out why the clients app was randomly crashing (fun).

We were provided the binary submitted to Apple along with the .dSYM file.
I found out about this Apple provided script called 'symbolicatecrash', which is a Perl script that will "translate" a .crash file into what exact point in your source code the app crashed at.

'symbolicatecrash' was located in my environment (XCode 3.2.6) in /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources.

I copied 'symbolicatecrash' to a folder containing the .dSYM, .app, and .crash files and ran the following command:

./symbolicatecrash -A -v 'app_name.crash' app_name.app.dSYM

That will output to standard output the crash log with source code info instead of memory addresses.


Friday, October 14, 2011

From Device Crash Log to Stack Trace

Update:  If this doesn't work for you anymore, try this:
http://iphoneidoit.blogspot.com/2016/03/reading-crash-logs.html

There seems to be a few ways to get the stack trace from the device logs.  One way is a 3rd party solution where you implement their API and they can send you a nice stack trace.  Another way is by using symbolicate, which seemed out of date.

Until I get around to using the 3rd party solution I use the atos command.  Below is a step by step in how you can get a stack trace from your device's crash logs.  You will need the build that caused the crash and the crash log.  Note, there may be an easier way to do this, I just haven't looked more after finding this method.

A typical unreadable crash log contains something like this:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000008
Crashed Thread:  6

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:

0   libicucore.A.dylib            0x318fb3c8 0x31897000 + 410568
1   libsystem_c.dylib             0x3310850a 0x330bb000 + 316682
2   libicucore.A.dylib            0x31971744 0x31897000 + 894788
3   libicucore.A.dylib            0x318a59b8 0x31897000 + 59832
4   libicucore.A.dylib            0x3189fe98 0x31897000 + 36504
5   CoreFoundation                0x34c6b042 0x34bef000 + 507970
6   CoreFoundation                0x34c2f14a 0x34bef000 + 262474
7   Foundation                    0x320d4020 0x320aa000 + 172064
8   Foundation                    0x320d3efe 0x320aa000 + 171774
...

For starters, turn that into this:
0x318fb3c8 0x31897000 + 410568 0x3310850a 0x330bb000 + 316682 0x31971744 0x31897000 + 894788 0x318a59b8 0x31897000 + 59832 0x3189fe98 0x31897000 + 36504 0x34c6b042 0x34bef000 + 507970 0x34c2f14a 0x34bef000 + 262474 0x320d4020 0x320aa000 + 172064 0x320d3efe 0x320aa000 + 171774

Just take out the first two columns and the carriage returns.  Save this to a file in some easy to type directory like ~/memory_addresses.txt

Get the Build
Get the binary where the error was generated from.  It should have a filename of something like mycrashingapp.app.

ATOS command
Navigate to where the app binary file is and type in the following, replace the bold with your specific info.

atos -o mycrashingapp.app/mycrashingapp -arch armv6 -f ~/memory_addresses.txt > stack.txt

stack.txt should now contain some useful information on where the crash happened.