Xcode 11.4 - Crash when code coverage is enabled

Hi,


We are getting a crash after excuting all unit tests when code coverage is enabled. Please find the stack trace below


Crashed Thread: 0 ReceiverMainThread Dispatch queue: com.apple.main-thread



Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Codes: EXC_I386_GPFLT

Exception Note: EXC_CORPSE_NOTIFY



Termination Signal: Segmentation fault: 11

Termination Reason: Namespace SIGNAL, Code 0xb

Terminating Process: exc handler [41136]



Application Specific Information:

CoreSimulator 704.12 - Device: iPad Pro (12.9-inch) (3rd generation) (C0064E72-B310-4A5B-82BE-BCC12D3E4D46) - Runtime: iOS 13.4 (17E255) - DeviceType: iPad Pro (12.9-inch) (3rd generation)



Thread 0 Crashed:: ReceiverMainThread Dispatch queue: com.apple.main-thread

0 com.ios.Dev 0x000000010ea6f368 initializeValueProfRuntimeRecord + 56

1 com.ios.Dev 0x000000010ea733aa writeOneValueProfData + 170

2 com.ios.Dev 0x000000010ea7323b lprofWriteDataImpl + 683

3 com.ios.Dev 0x000000010ea72f7d lprofWriteData + 109

4 com.ios.Dev 0x000000010ea7151a writeFile + 714

5 com.ios.Dev 0x000000010ea7118f __llvm_profile_write_file + 1007

6 libsystem_c.dylib 0x00007fff51a65a38 __cxa_finalize_ranges + 326

7 libsystem_c.dylib 0x00007fff51a65d56 exit + 48

8 com.apple.dt.XCTest 0x00000001124ea721 _XCTestMain + 2709

9 libXCTestBundleInject.dylib 0x000000011138abfa __RunTests_block_invoke_2 + 13

10 com.apple.CoreFoundation 0x00007fff23da1a9c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12

11 com.apple.CoreFoundation 0x00007fff23da1193 __CFRunLoopDoBlocks + 195

12 com.apple.CoreFoundation 0x00007fff23d9bf83 __CFRunLoopRun + 995

13 com.apple.CoreFoundation 0x00007fff23d9b884 CFRunLoopRunSpecific + 404

14 com.apple.GeoServices 0x00007fff38b5ac1a GSEventRunModal + 139

15 com.apple.UIKitCore 0x00007fff48c19220 UIApplicationMain + 1605

16 com.ios.Dev 0x000000010e7be223 main + 430 (main.m:125)

17 libdyld.dylib 0x00007fff519b910d start + 1


This crash is only happening on XCode 11.4, if code coverage is enabled. If code coverage is disabled it works fine, but we want the code coverage after executing unit tests. In Xcode 11.3 unit tests were executing fine with the code coverage enabled. Could any one please let us know the solution for this issue. Thanks in advance.


Thanks,

Arjun

Replies

For us changing the Macho-O-Type of one of the dependencies from Relocatable Object File to Static Library solved the issue. But not sure if this is the only cause for this issue as there might be multiple reasons.

Based on the stack trace, there appears to be a crash occurring in the profiling runtime (which accumulates code coverage data during the execution of your app, and then writes it to disk when the app terminates). Can you please submit a Feedback Assistant for this issue? Attaching the crash report, as well as your configuration (Xcode version and simulator) would be extremely useful. If you have a sample project that reproduces the issue, please attach that as well. Thank you!