App crashes with "ERROR: Interceptors are not working" when addressSanitizer enabled
Xcode : 10.1 Swift : 4.2.1
Steps:
Create a dummy Single View App
build using :
xcodebuild -project BluepillCrashTest.xcodeproj -scheme BluepillCrashTest -sdk iphonesimulator -destination 'platform=iOS Simulator,id=<simulator_id>, OS=12.1' build-for-testing -enableAddressSanitizer YES
run bluepill using :
bluepill --xctestrun-path <path_to_xctestrun> -n 1 -d 'iPhone Xs' -v on
App crashes with error below:
[ INFO ] (BP-1) Running Tests. Attempt Number 1.
{54439} 20190515.125828 [ INFO ] (BP-1) [Attempt 1] Create Simulator
{54439} 20190515.125828 [ INFO ] (BP-1) Booting a simulator without launching Simulator app
{54419} 20190515.125828 [ INFO ] (BLUEPILL) 1 BP still running. [1]
{54419} 20190515.125828 [ INFO ] (BLUEPILL) Using 404 of 2128 processes.
{54439} 20190515.125829 [ INFO ] (BP-1) Simulator 615CF8EC-E221-4261-B170-9C013FAD30FB achieved the BOOTED state Booted
{54439} 20190515.125829 [ INFO ] (BP-1) Completed: [Attempt 1] Create Simulator 615CF8EC-E221-4261-B170-9C013FAD30FB
{54439} 20190515.125829 [ INFO ] (BP-1) [Attempt 1] Install Application
{54439} 20190515.125829 [ DEBUG ] (BP-1) installApplication: host bundleId: com.apple.test.BluepillCrashTestUITests-Runner, host BundlePath: /Users/kaansariveli/Library/Developer/Xcode/DerivedData/BluepillCrashTest-cpmdcidbqwkeugelllpjhovjdhdg/Build/Products/Debug-iphonesimulator/BluepillCrashTestUITests-Runner.app, testRunnerAppPath: /Users/kaansariveli/Library/Developer/Xcode/DerivedData/BluepillCrashTest-cpmdcidbqwkeugelllpjhovjdhdg/Build/Products/Debug-iphonesimulator/BluepillCrashTestUITests-Runner.app
{54439} 20190515.125838 [ INFO ] (BP-1) Completed: [Attempt 1] Install Application
{54439} 20190515.125838 [ INFO ] (BP-1) [Attempt 1] Launch Application
{54439} 20190515.125844 [ INFO ] (BP-1) Launch succeeded
{54439} 20190515.125844 [ INFO ] (BP-1) No error
{54439} 20190515.125844 [ INFO ] (BP-1) Completion block for launch
{54439} 20190515.125844 [ INFO ] (BP-1) Calling completion block with: (null) - 54571
{54439} 20190515.125844 [ INFO ] (BP-1) Completed: [Attempt 1] Launch Application
**{54439} 20190515.125844 [ DEBUG ] (BP-1) [OUTPUT] ==54571==ERROR: Interceptors are not working. This may be because AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:
{54439} 20190515.125844 [ DEBUG ] (BP-1) [OUTPUT] DYLD_INSERT_LIBRARIES=/Users/kaansariveli/Library/Developer/Xcode/DerivedData/BluepillCrashTest-cpmdcidbqwkeugelllpjhovjdhdg/Build/Products/Debug-iphonesimulator/BluepillCrashTestUITests-Runner.app/PlugIns/BluepillCrashTestUITests.xctest/Frameworks/libclang_rt.asan_iossim_dynamic.dylib
{54439} 20190515.125844 [ DEBUG ] (BP-1) [OUTPUT] "interceptors not installed" && 0
{54439} 20190515.125844 [ DEBUG ] (BP-1) [OUTPUT] BP_APP_PROC_ENDED
{54439} 20190515.125844 [ CRASH ] (BP-1) App crashed before tests started.**
{54439} 20190515.125844 [ DEBUG ] (BP-1) Attempting to add empty test name or class to the executed list
It works well without addressSanitizer
I managed to reproduce this locally in the test suite by enabling the Address Sanitizer for the BPSampleApp and running the UI test for bp. I think the bug is that we're not honoring the DYLD_INSERT_LIBRARIES flag in the xctestrun file. I'll poke a bit more and come up with a fix. Thanks for reporting.
Any update on this? This error is causing problem in my application too. It would be great if you can fix it as early as possible.