Index: b\compiler-rt\lib\interception\interception_win.cpp =================================================================== --- b\compiler-rt\lib\interception\interception_win.cpp +++ b\compiler-rt\lib\interception\interception_win.cpp @@ -141,8 +141,28 @@ static const int kDirectBranchLength = kBranchLength + kAddressLength; static void InterceptionFailed() { - // Do we have a good way to abort with an error message here? - __debugbreak(); + /* If the user wants to continue past an interception failure, they can set + * this variable. If not, these failures should be fatal, prompting them to + * open a debugger. */ + char dummy_buffer[1] = {0}; + bool break_on_interception_failure = + GetEnvironmentVariableA("ASAN_WIN_CONTINUE_ON_INTERCEPTION_FAILURE", + dummy_buffer, 0) == 0; + bool debugger_is_present = IsDebuggerPresent(); + if (debugger_is_present) { + OutputDebugStringA( + "====================================================================\n" + "Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "AddressSanitizer (ASan) interception failed for a targeted function.\n" + "Please file a bug report which includes your Windows build number.\n" + "This is listed as 'OS Version' in the command output from \n" + "systeminfo.\n" + "====================================================================\n" + ); + } + if (break_on_interception_failure || debugger_is_present) { + DebugBreak(); + } } static bool DistanceIsWithin2Gig(uptr from, uptr target) {