2

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.

Edit:Resolution

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.

Arjuna
  • 697
  • 4
  • 17

3 Answers3

0

I have exactly the same issue, and I'm still suffering in the Xcode 11.4.1. I saw also you @Arjuna posting in the Apple developer forum:

https://forums.developer.apple.com/thread/131988

I didn't find any solution so far, but I think that this is related to the features introduced in the Xcode 11.4

https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_release_notes

Following the Releases Notes we have:

When building a scheme that has been converted to use test plans and whose active test plan has code coverage enabled, Xcode now includes code coverage instrumentation when building for the ‘Run’ action, in addition to the ‘Test’ action. This matches the behavior of building schemes which don’t use test plans and have code coverage enabled, and avoids unnecessary rebuilds when alternating between running and testing actions. (57367856)

I'm pretty sure that somehow is related to this, but I'm still no able to find a way to fix it.

fjtrujy
  • 129
  • 4
  • 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. – Arjuna May 21 '20 at 08:55
0

try to disable code coverage. it helps in my case

Alex
  • 1,603
  • 1
  • 16
  • 11
0

Try with disabled main thread checkerenter image description here

shalu tyagi
  • 148
  • 8