iOS crash reports: atos not working as expected

crash-reports, ios, iphone, symbolicate, symbolicatecrash

Solution

You have to calculate the address to use with atos, you can't just use the one in the stacktrace.

symbol address = slide + stack address - load address

The `slide` value is the value of `vmaddr` in `LC_SEGMENT cmd` (Mostly this is `0x1000`). Run the following to get it:

otool -arch ARCHITECTURE -l "APP_BUNDLE/APP_EXECUTABLE" | grep -B 3 -A 8 -m 2 "__TEXT"

Replace `ARCHITECTURE` with the actual architecture the crash report shows, e.g. `armv7`. Replace `APP_BUNDLE/APP_EXECUTABLE` with the path to the actual executable.

The `stack address` is the hex value from the crash report.

The `load address` can be is the first address showing in the `Binary Images` section at the very front of the line which contains your executable. (Usually the first entry).

Since in the past value of the `slide` was equal to value of the `load address` this always worked. But since Apple introduced Address space layout randomization beginning with iOS 4.3 (in different variations), the apps loading address is randomized for security reasons.

Problem

I'm looking at a crash report provided by Apple ``` Hardware Model: iPhone4,1 Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2012-11-18 16:03:44.951 -0600 OS Version: iOS 6.0.1 (10A523) Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x51fe5264 Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x352925b0 objc_msgSend + 16 1 MYAPP 0x0006573a -[MyViewController(Images) didReceiveImage:context:etag:expires:] + 42 2 MYAPP 0x0004fb26 -[MyImageTask didReceiveImage:] + 98 3 Foundation 0x361ac8e8 __NSThreadPerformPerform 4 CoreFoundation 0x3b37d680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 5 CoreFoundation 0x3b37cee4 __CFRunLoopDoSources0 6 CoreFoundation 0x3b37bcb2 __CFRunLoopRun 7 CoreFoundation 0x3b2eeeb8 CFRunLoopRunSpecific 8 CoreFoundation 0x3b2eed44 CFRunLoopRunInMode 9 GraphicsServices 0x396bc2e6 GSEventRunModal 10 UIKit 0x3452e2f4 UIApplicationMain 11 MYAPP 0x0004934a main + 70 12 MYAPP 0x000492fc start + 36 ``` The funny thing is when I use atos to lookup the line of code that corresponds to address locations 0x0006573a and 0x0004fb26 I get completely different match. The atos output is not even from the same class that's mentioned in the crash log (MyViewController, MyImageTask). Instead atos points me to totally benign lines of code in a completely unrelated class. I verified again that I'm working with the exact dSYM and IPA that I submitted to Apple. My atos command ``` /Applications/Xcode.app/Contents/Developer/usr/bin/atos -arch armv7 -o MYAPP.app/MYAPP 0x0004fb26 ``` Same result with /usr/bin/atos and for armv7s. Has anyone else experienced this issue? Can you please advise? Thanks.

Original source

Related problems