- add XFAIL/UNSUPPORTED annotations for tests run wtih real MSVC - macroify usages of clang-specific attributes in asan tests - Add substitution for /Oy-/-fno-omit-frame-pointer This makes the dll_intercept_memset test work with mingw These are most of the changes that are required to get things running with MSVC, however there are some remaining build-flag tweaks. Nothing in here should be a functional change.
38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
// Test the handle_sigill option.
|
|
//
|
|
// RUN: %clangxx_asan %s -o %t && %env_asan_opts=handle_sigill=0 not --crash %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0
|
|
// RUN: %clangxx_asan %s -o %t && %env_asan_opts=handle_sigill=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1
|
|
// REQUIRES: x86-target-arch && (!MSVC || asan-32-bits)
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
// note: test is limited to i386 only ("asan-32-bits") when using "real" MSVC
|
|
// see the requires clause above
|
|
#if defined(_MSC_VER) && !defined(__clang__)
|
|
# define __builtin_trap() __asm ud2;
|
|
#endif
|
|
|
|
int main(int argc, char **argv) {
|
|
#ifdef _WIN32
|
|
// Sometimes on Windows this test generates a WER fault dialog. Suppress that.
|
|
UINT new_flags = SEM_FAILCRITICALERRORS |
|
|
SEM_NOGPFAULTERRORBOX |
|
|
SEM_NOOPENFILEERRORBOX;
|
|
// Preserve existing error mode, as discussed at
|
|
// http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
|
|
UINT existing_flags = SetErrorMode(new_flags);
|
|
SetErrorMode(existing_flags | new_flags);
|
|
#endif
|
|
|
|
if (argc)
|
|
__builtin_trap();
|
|
// Unreachable code to avoid confusing the Windows unwinder.
|
|
#ifdef _WIN32
|
|
SetErrorMode(0);
|
|
#endif
|
|
}
|
|
// CHECK0-NOT: ERROR: AddressSanitizer
|
|
// CHECK1: ERROR: AddressSanitizer: {{ILL|illegal-instruction}} on unknown address {{0x0*}}
|