为什么 "Enable Address Sanitizer" 在 Xcode 7 中被禁用?

Why is "Enable Address Sanitizer" disabled in Xcode 7?

我在新 Xcode 7 的 Apple docs 中读到了 运行time Sanitization,所以我查找了它,发现它已被禁用。我正在使用 Xcode 7 GM 种子。

当我进入方案 > 诊断选项卡的 运行 操作时,Enable Address Sanitizer 选项被禁用:

有一些关于如何禁用其他选项的解释,但没有提及为什么禁用清理选项:

Some diagnostic tools can be used in combination with others; the options available on the Diagnostics pane are enabled and disabled as different options are chosen to help you select option combinations. For example, enable the address sanitizer and other, incompatible tools are disabled and cannot be chosen

查看 Clang 3.8 documentation for Addresssanitizer,看起来它也可以通过添加标志启用:-fsanitize=address。但是这个标志应该在构建设置中的什么地方使用是一个谜,而且值得怀疑,因为它在方案中也作为一个复选框选项存在。

也找到了这个 SO answer,但它相当复杂,而且可能已经过时,因为它是 2013 年的。

您目前不能同时使用 Guard Malloc 和 Address Sanitizer。选择 Enable Guard Malloc 复选框会禁用 Enable Address Sanitizer 复选框。如果您想使用 Address Sanitizer,请取消选中启用 Guard Malloc 复选框。

您还需要确保选择了 Mac/iOS/TV 模拟器,而不是设备。不支持手表模拟器。 (截至 Xcode 9)