App crash , Xcode11.4, iOS 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s)

左心房为你撑大大i 提交于 2020-05-25 07:08:11

问题


Our app crash on os 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s 32) compiled by Xcode 11.4, swift optimization on. We find the PC register point to a hole address without virtual address and no stack information. If we close swift optimization, it works.

So do anyone find the problem and any solution?

It's certain that it's related to Xcode 11.4 swift optimization.

I find the same question here. https://www.reddit.com/r/iOSProgramming/comments/frcpsc/xcode_114_builds_crashes_on_ios_10/

Incident Identifier: 2224949E-E5E3-479C-9B08-4FD1473144B3
CrashReporter Key:   052c9a28855da965790a6dcc0885097a66ee4eff
Hardware Model:      iPad3,4
Process:             AAAAA [34872]
Path:                /private/var/containers/Bundle/Application/xxxxxx....
Identifier:          com.xxx.xxxxx
Version:             xxxx
Code Type:           ARM (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:           com.xxx.xxxxx [1932]


Date/Time:           2020-03-30 22:42:49.2564 +xxx
Launch Time:         2020-03-30 22:42:47.0000 +xxx
OS Version:          iPhone OS 10.3.3 (14G60)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x015fa500
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   ???                             0x015fa500 0 + 23045376

回答1:


After lots of analysis such as log and instruction debug, I am surely it's a bug xcode 11.4 swift compiler optimization. Detailedly, the optimization cause a stack pointer (fp) messy at the point opening a new function stack frame. I show it in the following.

Here is a helper function type metadata accessor for myapp.MainViewController at <compiler-generated> generated by compiler in our mainviewcontroller.

<+0>, <+4> is wrong. It should be

0x6cd85c <+0>:   push.w {r4, r5, r6, r7, lr}
0x6cd860 <+4>:   add  r7, sp, #0xc

r7 is fp. so the error instruction <+0> don`t save r7, and <+4> sub ins makes r7 lower than sp a lot that causes all whole stack messy. So It's wrong clearly.

This is what happens when the ins execute.

Before:

After:

The whole stack loses becuase of fp error.

And we can also verify that in xcode 11.3. <+0> <+2> is the same as our expectation above.

So we have to downgrade to xcode 11.3 as well and use runtime refection to adapt new iOS SDK feature that should be call in xcode 11.4.




回答2:


We have also encountered multiple crashed on old 32-Bit devices with iOS 9 or 10. Recompiling with Xcode 11.3.1 fixed those random crashes in my case...

There is also a open Bug for this topic at https://bugs.swift.org/browse/SR-12511




回答3:


This is fixed for us in Xcode 11.5. GM_Seed is available since May 18.

https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11.5_GM_Seed/Xcode_11.5_GM_Seed.xip



来源:https://stackoverflow.com/questions/61074507/app-crash-xcode11-4-ios-10-3-3-10-3-4-iphone-5c-5-ipad4-armv7s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!