Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

enter image description here

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.

like image 925
Sheamus Avatar asked Sep 17 '15 14:09

Sheamus


2 Answers

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.

like image 168
Swift Dev Journal Avatar answered Nov 17 '22 11:11

Swift Dev Journal


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)

like image 3
Bob Peterson Avatar answered Nov 17 '22 10:11

Bob Peterson