2

在启用代码覆盖率时执行所有单元测试后,我们遇到了崩溃。请在下面找到堆栈跟踪

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

如果启用了代码覆盖,则此崩溃仅在 XCode 11.4 上发生。如果禁用代码覆盖率,它可以正常工作,但我们希望在执行单元测试后进行代码覆盖率。在 Xcode 11.3 中,单元测试在启用代码覆盖的情况下运行良好。任何人都可以让我们知道这个问题的解决方案。提前致谢。

编辑:分辨率

对我们来说,将其中一个依赖项的Macho-O-Type从可重定位对象文件更改为静态库解决了这个问题。但不确定这是否是导致此问题的唯一原因,因为可能有多种原因。

4

3 回答 3

0

尝试禁用代码覆盖率。对我来说有帮助

于 2020-09-21T12:36:25.127 回答
0

尝试禁用主线程检查器在此处输入图像描述

于 2020-12-11T19:07:00.907 回答
0

我有完全相同的问题,我仍然在受苦Xcode 11.4.1。我还看到你 @Arjuna 在 Apple 开发者论坛上发帖:

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

到目前为止我没有找到任何解决方案,但我认为这与中引入的功能有关Xcode 11.4

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

Releases Notes我们有:

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)

我很确定这与此有关,但我仍然无法找到解决它的方法。

于 2020-05-20T14:08:30.513 回答