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

3

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
Blacksnake answered 7/4, 2020 at 7:6 Comment(0)
B
16

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.

enter image description here

<+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: enter image description here

After: enter image description here

The whole stack loses becuase of fp error.

And we can also verify that in xcode 11.3. enter image description here <+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.

Blacksnake answered 15/4, 2020 at 7:34 Comment(8)
Is it possible that this issue is resolved in Xcode 11.4.1? The release notes mention a couple of fixed crashes but I'm not sure if it covers this one. developer.apple.com/documentation/xcode_release_notes/…Kapellmeister
Yes, I notice the new version. But I don't still check it.Blacksnake
@VictorChoy A crash report from an iOS 13 device is pointing to the same issue reported by Firebase, is that even possible?Ptarmigan
@PedroPauloAmorim According to the picture, I find it happen in compiler-genertated function. I guess it's related to swift compiler as well. But our crash hardly happen in ios13. So I suggest debug the compiler-genertated instruction and have a analysis about the logic.Blacksnake
@TomKraina Sadly it looks like not fixed in Xcode 11.4.1.Blacksnake
@VictorChoy There is more information about the crash but I cannot share it here. What I can share is that the crashes happen when it calls a C++ code (mind that it crashes outside the C++ code), it does not point to anything in the code and I am sure that the crash is not in the latest function from the report, but it contains the crash reported above in the picture. I think it's a real high priority bug but Apple is classifying it as a medium one. I disagree with this.Ptarmigan
Definitely not fixed in XCode 11.4.1, but XCode 11.5 beta notes mention it so it should be fixed in 11.5 when it comes outAlimentary
Tried Xcode 11.x all the Xcode with version 11 or higher have this bug, kind of frustrating.Fane
A
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

Atmometer answered 14/4, 2020 at 13:0 Comment(1)
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.Blacksnake
C
1

This is fixed for us in Xcode 11.5. GM_Seed which 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

Congregationalist answered 18/5, 2020 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.