0

Random Crashes with Xcode 4, LLVM 2.0, and armv6

Posted May 9th, 2011 in Xcode, iPhone by Chris Gummer

After recently deploying a simple update to Boxing Timer, I started to get support requests about the app crashing. I couldn’t understand what would cause the crashes as the update was simply adding French localisation. Some quick smoke testing revealed no issues on an iPhone 4 or iPad. However, reverting back to an iPhone 3G or iPod touch G2, I was able to reproduce the crash. What was particularly strange was that the crash could only be reproduced by exercising a very specific code path. In general though, the app seemed to work fine. However, when the app did crash the logs looked something like this:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0×00000002
Crashed Thread: 0

Thread 0 Crashed:
0 ??? 0×00000002 0 + 2

Thread 1:
0 libSystem.B.dylib 0×000014b8 mach_msg_trap + 20
1 libSystem.B.dylib 0×00004094 mach_msg + 60
2 CoreFoundation 0×00057002 CFRunLoopRunSpecific + 982
3 CoreFoundation 0×00056c18 CFRunLoopRunInMode + 44
4 WebCore 0×000846f0 RunWebThread(void*) + 412
5 libSystem.B.dylib 0×0002b7b0 _pthread_body + 20

Thread 0 crashed with ARM Thread State:
r0: 0×00000000 r1: 0×00000000 r2: 0×380ab7fc r3: 0×00138a50
r4: 0×00138a50 r5: 0×00019dd0 r6: 0×00138a50 r7: 0×3817b1b4
r8: 0×00170f80 r9: 0×001fc098 r10: 0×00000004 r11: 0×38179ff4
ip: 0×3810a810 sp: 0×2ffff300 lr: 0×30b336c4 pc: 0×00000002

As it turned out the LLVM 2.0 compiler that shipped with Xcode 4.0 and 4.0.1 was responsible for these crashes. Fortunately Xcode 4.0.2 has fixed this issue. I was able to rebuild my app and get an expedited review, which equals happy customers again!

In a nutshell if you’ve been using Xcode 4.0 or 4.0.1 to build your apps with LLVM 2.0, they will most likely experience crashes on armv6 devices. So make sure you’ve upgraded to Xcode 4.0.2.

Comments are closed.