Why is “Enable Address Sanitizer” disabled in Xcode 7?

喜夏-厌秋 提交于 2019-12-08 15:38:27

问题


I read about the Runtime Sanitization in the Apple docs in the new Xcode 7, so I looked for it, and found that it's disabled. I'm using Xcode 7 GM seed.

When I go into the Run action of the scheme > Diagnostics tab, the Enable Address Sanitizer option is disabled:

There is some explanation about how other options are disbled, but no mention of why the sanitization option would be disabled:

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

Looking at the Clang 3.8 documentation for Addresssanitizer, it looks like it can also be enabled, by adding a flag: -fsanitize=address. But where this flag should be used in the build settings is a mystery, and questionable since it also exists as a checkbox option in the scheme.

Also found this SO answer, but it is rather complex, and probably outdated, since it was back in 2013.


回答1:


You can't currently use Guard Malloc and Address Sanitizer together. Selecting the Enable Guard Malloc checkbox disables the Enable Address Sanitizer checkbox. Deselect the Enable Guard Malloc checkbox if you want to use Address Sanitizer.




回答2:


You also need to be sure you have a Mac/iOS/TV simulator selected, not a device. Watch simulator is not supported. (As of Xcode 9)



来源:https://stackoverflow.com/questions/32632496/why-is-enable-address-sanitizer-disabled-in-xcode-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!