Incomplete crash log symbolication for bitcode-enabled apps linked with packages containing resources

I just wanted to inform you about an issue I discovered in Swift Packages containing resources.

If an app is built with bitcode enabled and integrates an SPM 5.3 package containing at least one resource, its BCSymbolMaps is messed up, leading to incomplete crash log symbolication.

Hope this can be helpful should you stumble on the same issue with your applications.

Example

I was recently looking at crash logs for my apps and discovered a bunch of _hidden entries in the stack trace:

Last Exception Backtrace:
0   CoreFoundation                       0x00000001986a9344 __exceptionPreprocess + 228
1   libobjc.A.dylib                      0x00000001983becc0 objc_exception_throw + 56
2   CoreFoundation                       0x00000001985a6878 +[NSException raise:format:arguments:] + 96
3   Foundation                           0x00000001989f8160 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128
4   My app                               0x00000001029a972c _hidden#0_ (__hidden#81_:18)
5   My app                               0x00000001029ab09c _hidden#94_ (__hidden#146_:107)
6   My app                               0x0000000102989f50 _hidden#1138_ (__hidden#1506_:858)
7   My app                               0x0000000102989de0 _hidden#1137_ (__hidden#1506_:896)
8   My app                               0x00000001029de1bc _hidden#34_ (__hidden#115_:67)
9   My app                               0x0000000102941578 _hidden#55_ (__hidden#145_:110)

All _hidden entries are associated with an SPM 5.3 package containing resources. If the exact same package didn't contain any resources, the crash log above would be entirely symbolicated.

Remark

The fact that this production code crashes on an assertion is also unusual. I opened a dedicated thread to explain and discuss this matter separately.

Bug reporting

I opened a dedicated radar. There is sadly no workaround, I am afraid.

5 Likes

I'm having the same issue our app crashes are basically unreadable. If anyone has a temporary fix that would be a life saver.

2 Likes

I think this should be moved to the “Using Swift” category; and that the issue is an absolute dealbreaker for SPM with resources right now :pensive:
I hope it’s fixed in 12.4, but I haven’t had time to check yet.

@NeoNacho can you help with this?

This problem should be solved in 12.5 beta 1.

4 Likes

Thank you for notified us here.

I've just tested with Xcode 12.5 beta 1 and @defagos shared example, and I confirmed that the __hidden#_ symbols are not in the bcsymbolmap file anymore.

2 Likes

That's fantastic news, thank you very much for the fix!