iosxcodeadhocsymbolicatecrashbitcode

Why does recompiling from bitcode make me unable to symbolicate in Xcode ad hoc releases and how do I fix it?


So this has be driving me nuts but I finally found out that the bitcode compile option when I export my app for adhoc deployment is causing my debug symbol file (dSYM) and my app UUID to mismatch meaning I cannot symbolicate any crash logs.

Turning off the option fixes this but is there a way I can have it be fixed with the option on? I read the tip for that option and it says the store uses this method. Will I be unable to read crash logs from the app store now too or is this just a local problem?

Here is what I get from an old build before this Xcode version:

dwarfdump --uuid app
DD25E6C9-... (armv7)
29F74B2E-... (arm64)

dwarfdump --uuid app.dsym
DD25E6C9... (armv7)
29F74B2E... (arm64)

Fine. Now with bitcode on:

dwarfdump --uuid app
E7D2BE71-... (armv7)
5C871FD7-... (arm64)

dwarfdump --uuid app.dsym
BC93BCF5-... (armv7)
3312658C... (arm64)

Obviously it won't symbolicate. I have tried it with the option off and it matches again. Is this a problem with Xcode not regenerating symbols for the new bitcode build? And why oh why does this default to ON and not warn you about your crash logs??


Solution

  • When bitcode is enabled, XCode archiving process produces: 1. Native arm64 or armv7 code 2. Bitcode 3. dSYM file (matches the UUID of the native code)

    When you generate an ad-hoc distribution and enable the "bitcode compile" option, XCode recompiles Bitcode into Native as well, which might and usually does result in a different UUIDs for the arm64 and armv7 parts. The original app.dSYM is not touched (and thus doesn't match the new binaries), instead new dSYMs are being generated in the same xcarchive folder, they have the form of "E2015333-1220-391E-928C-04C32A179EC9.dSYM" and match the actual UUIDs of the newly compiled binaries.

    The story doesn't always end there, these new dSYM files might be obfuscated (i.e have __hidden#232434 instead of the actual symbol names). The mappings to deobfuscate them also reside in the xcarchive folder in a folder names "BCSymbolMaps".

    To de-obfuscate such a dSYM one would use the following command:

    dsymutil --symbol-map <bcSymbol-file> <obfuscated-dsym-file>