Index: compiler-rt/test/CMakeLists.txt =================================================================== --- compiler-rt/test/CMakeLists.txt +++ compiler-rt/test/CMakeLists.txt @@ -23,9 +23,6 @@ list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS clang clang-resource-headers FileCheck count not llvm-config llvm-nm llvm-objdump llvm-readobj llvm-symbolizer compiler-rt-headers sancov) - if (WIN32) - list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor) - endif() endif() endif() Index: compiler-rt/test/cfi/anon-namespace.cpp =================================================================== --- compiler-rt/test/cfi/anon-namespace.cpp +++ compiler-rt/test/cfi/anon-namespace.cpp @@ -1,22 +1,22 @@ // RUN: %clangxx_cfi -c -DTU1 -o %t1.o %s // RUN: %clangxx_cfi -c -DTU2 -o %t2.o %S/../cfi/anon-namespace.cpp // RUN: %clangxx_cfi -o %t1 %t1.o %t2.o -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -c -DTU1 -DB32 -o %t1.o %s // RUN: %clangxx_cfi -c -DTU2 -DB32 -o %t2.o %S/../cfi/anon-namespace.cpp // RUN: %clangxx_cfi -o %t2 %t1.o %t2.o -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -c -DTU1 -DB64 -o %t1.o %s // RUN: %clangxx_cfi -c -DTU2 -DB64 -o %t2.o %S/../cfi/anon-namespace.cpp // RUN: %clangxx_cfi -o %t3 %t1.o %t2.o -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -c -DTU1 -DBM -o %t1.o %s // RUN: %clangxx_cfi -c -DTU2 -DBM -o %t2.o %S/../cfi/anon-namespace.cpp // RUN: %clangxx_cfi -o %t4 %t1.o %t2.o -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -c -DTU1 -o %t1.o %s // RUN: %clangxx -c -DTU2 -o %t2.o %S/../cfi/anon-namespace.cpp Index: compiler-rt/test/cfi/bad-cast.cpp =================================================================== --- compiler-rt/test/cfi/bad-cast.cpp +++ compiler-rt/test/cfi/bad-cast.cpp @@ -1,52 +1,52 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 a 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t1 b 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t1 c 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t1 a 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t1 b 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t1 c 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t1 d 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t1 e 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t1 f 2>&1 | FileCheck --check-prefix=PASS %s -// RUN: %expect_crash %run %t1 g 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t1 g 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t1 h 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 a 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t2 b 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t2 c 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t2 a 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t2 b 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t2 c 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t2 d 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t2 e 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t2 f 2>&1 | FileCheck --check-prefix=PASS %s -// RUN: %expect_crash %run %t2 g 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t2 g 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t2 h 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 a 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t3 b 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t3 c 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t3 a 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t3 b 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t3 c 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t3 d 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t3 e 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t3 f 2>&1 | FileCheck --check-prefix=PASS %s -// RUN: %expect_crash %run %t3 g 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t3 g 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t3 h 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 a 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t4 b 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t4 c 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t4 a 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t4 b 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t4 c 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t4 d 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t4 e 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %run %t4 f 2>&1 | FileCheck --check-prefix=PASS %s -// RUN: %expect_crash %run %t4 g 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t4 g 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %run %t4 h 2>&1 | FileCheck --check-prefix=PASS %s // RUN: %clangxx_cfi -fsanitize=cfi-cast-strict -o %t5 %s -// RUN: %expect_crash %run %t5 a 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 b 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 c 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 d 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 e 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 f 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 g 2>&1 | FileCheck --check-prefix=FAIL %s -// RUN: %expect_crash %run %t5 h 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 a 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 b 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 c 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 d 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 e 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 f 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 g 2>&1 | FileCheck --check-prefix=FAIL %s +// RUN: not --crash %run %t5 h 2>&1 | FileCheck --check-prefix=FAIL %s // RUN: %clangxx -o %t6 %s // RUN: %run %t6 a 2>&1 | FileCheck --check-prefix=PASS %s Index: compiler-rt/test/cfi/base-derived-destructor.cpp =================================================================== --- compiler-rt/test/cfi/base-derived-destructor.cpp +++ compiler-rt/test/cfi/base-derived-destructor.cpp @@ -1,50 +1,50 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -o %t5 %s -// RUN: %expect_crash %run %t5 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t5 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DB32 -o %t6 %s -// RUN: %expect_crash %run %t6 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t6 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DB64 -o %t7 %s -// RUN: %expect_crash %run %t7 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t7 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DBM -o %t8 %s -// RUN: %expect_crash %run %t8 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t8 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -o %t9 %s -// RUN: %expect_crash %run %t9 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t9 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DB32 -o %t10 %s -// RUN: %expect_crash %run %t10 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t10 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DB64 -o %t11 %s -// RUN: %expect_crash %run %t11 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t11 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DBM -o %t12 %s -// RUN: %expect_crash %run %t12 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t12 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -o %t13 %s -// RUN: %expect_crash %run %t13 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t13 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DB32 -o %t14 %s -// RUN: %expect_crash %run %t14 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t14 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DB64 -o %t15 %s -// RUN: %expect_crash %run %t15 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t15 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DBM -o %t16 %s -// RUN: %expect_crash %run %t16 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t16 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi_diag -o %t17 %s // RUN: %run %t17 2>&1 | FileCheck --check-prefix=CFI-DIAG %s Index: compiler-rt/test/cfi/cross-dso/icall/diag.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/icall/diag.cpp +++ compiler-rt/test/cfi/cross-dso/icall/diag.cpp @@ -27,7 +27,7 @@ // RUN: %clangxx_cfi_dso_diag -fsanitize-trap=cfi-icall -fno-sanitize-recover=cfi-unrelated-cast \ // RUN: -g %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ +// RUN: not --crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ // RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL // RUN: not %t _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \ @@ -44,7 +44,7 @@ // RUN: %clangxx_cfi_dso_diag \ // RUN: -g %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ +// RUN: not --crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ // RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL // RUN: not %t _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-DIAG \ @@ -61,13 +61,13 @@ // RUN: %clangxx_cfi_dso -fno-sanitize-trap=cfi-nvcall \ // RUN: -g %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ +// RUN: not --crash %t icv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ // RUN: --check-prefix=VCALL-NODIAG --check-prefix=ICALL-FATAL -// RUN: %expect_crash %t _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ +// RUN: not --crash %t _cv 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ // RUN: --check-prefix=VCALL-NODIAG --check-prefix=CAST-FATAL -// RUN: %expect_crash %t __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ +// RUN: not --crash %t __v 2>&1 | FileCheck %s --check-prefix=ICALL-NODIAG --check-prefix=CAST-NODIAG \ // RUN: --check-prefix=VCALL-NODIAG --check-prefix=VCALL-FATAL // REQUIRES: cxxabi Index: compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp +++ compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp @@ -1,26 +1,26 @@ // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %t1-so.so // RUN: %clangxx_cfi_dso %s -o %t1 -// RUN: %expect_crash %t1 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t1 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s -// RUN: %expect_crash %t1 dlclose 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t1 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t1 dlclose 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi_dso -DB32 -DSHARED_LIB %s -fPIC -shared -o %t2-so.so // RUN: %clangxx_cfi_dso -DB32 %s -o %t2 -// RUN: %expect_crash %t2 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t2 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s -// RUN: %expect_crash %t2 dlclose 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t2 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t2 dlclose 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi_dso -DB64 -DSHARED_LIB %s -fPIC -shared -o %t3-so.so // RUN: %clangxx_cfi_dso -DB64 %s -o %t3 -// RUN: %expect_crash %t3 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t3 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s -// RUN: %expect_crash %t3 dlclose 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t3 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t3 dlclose 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi_dso -DBM -DSHARED_LIB %s -fPIC -shared -o %t4-so.so // RUN: %clangxx_cfi_dso -DBM %s -o %t4 -// RUN: %expect_crash %t4 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t4 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s -// RUN: %expect_crash %t4 dlclose 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t4 cast 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t4 dlclose 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -g -DBM -DSHARED_LIB -DNOCFI %s -fPIC -shared -o %t5-so.so // RUN: %clangxx -g -DBM -DNOCFI %s -ldl -o %t5 @@ -35,7 +35,7 @@ // RUN: %t6 cast 2>&1 | FileCheck --check-prefix=NCFI %s // Call-after-dlclose is checked on the caller side. -// RUN: %expect_crash %t6 dlclose 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t6 dlclose 2>&1 | FileCheck --check-prefix=CFI %s // Tests calls into dlopen-ed library. // REQUIRES: cxxabi Index: compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp +++ compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so -// RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && %expect_crash %t 2>&1 | FileCheck %s +// RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && not --crash %t 2>&1 | FileCheck %s // RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso_diag -g %s -o %t %ld_flags_rpath_exe && %t 2>&1 | FileCheck %s --check-prefix=CFI-DIAG Index: compiler-rt/test/cfi/cross-dso/icall/icall.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/icall/icall.cpp +++ compiler-rt/test/cfi/cross-dso/icall/icall.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so -// RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && %expect_crash %t 2>&1 | FileCheck %s +// RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe && not --crash %t 2>&1 | FileCheck %s // RUN: %clangxx_cfi_dso_diag -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso_diag -g %s -o %t %ld_flags_rpath_exe && %t 2>&1 | FileCheck %s --check-prefix=CFI-DIAG Index: compiler-rt/test/cfi/cross-dso/shadow_is_read_only.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/shadow_is_read_only.cpp +++ compiler-rt/test/cfi/cross-dso/shadow_is_read_only.cpp @@ -2,12 +2,12 @@ // RUN: %clangxx -std=c++11 -g -DSHARED_LIB %s -fPIC -shared -o %t-nocfi-so.so // RUN: %clangxx_cfi_dso -std=c++11 -g %s -o %t -// RUN: %expect_crash %t start 2>&1 | FileCheck %s -// RUN: %expect_crash %t mmap 2>&1 | FileCheck %s -// RUN: %expect_crash %t dlopen %t-cfi-so.so 2>&1 | FileCheck %s -// RUN: %expect_crash %t dlclose %t-cfi-so.so 2>&1 | FileCheck %s -// RUN: %expect_crash %t dlopen %t-nocfi-so.so 2>&1 | FileCheck %s -// RUN: %expect_crash %t dlclose %t-nocfi-so.so 2>&1 | FileCheck %s +// RUN: not --crash %t start 2>&1 | FileCheck %s +// RUN: not --crash %t mmap 2>&1 | FileCheck %s +// RUN: not --crash %t dlopen %t-cfi-so.so 2>&1 | FileCheck %s +// RUN: not --crash %t dlclose %t-cfi-so.so 2>&1 | FileCheck %s +// RUN: not --crash %t dlopen %t-nocfi-so.so 2>&1 | FileCheck %s +// RUN: not --crash %t dlclose %t-nocfi-so.so 2>&1 | FileCheck %s // Tests that shadow is read-only most of the time. // REQUIRES: cxxabi Index: compiler-rt/test/cfi/cross-dso/simple-fail.cpp =================================================================== --- compiler-rt/test/cfi/cross-dso/simple-fail.cpp +++ compiler-rt/test/cfi/cross-dso/simple-fail.cpp @@ -1,22 +1,22 @@ // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s // RUN: %clangxx_cfi_dso -DB32 -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso -DB32 %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s // RUN: %clangxx_cfi_dso -DB64 -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso -DB64 %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s // RUN: %clangxx_cfi_dso -DBM -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_dso -DBM %s -o %t %ld_flags_rpath_exe -// RUN: %expect_crash %t 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI-CAST %s // RUN: %clangxx -DBM -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx -DBM %s -o %t %ld_flags_rpath_exe Index: compiler-rt/test/cfi/icall/bad-signature.c =================================================================== --- compiler-rt/test/cfi/icall/bad-signature.c +++ compiler-rt/test/cfi/icall/bad-signature.c @@ -2,7 +2,7 @@ // RUN: %t1 2>&1 | FileCheck --check-prefix=NCFI %s // RUN: %clang_cfi -o %t2 %s -// RUN: %expect_crash %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clang_cfi_diag -g -o %t3 %s // RUN: %t3 2>&1 | FileCheck --check-prefix=CFI-DIAG %s Index: compiler-rt/test/cfi/icall/wrong-signature-mixed-lto.c =================================================================== --- compiler-rt/test/cfi/icall/wrong-signature-mixed-lto.c +++ compiler-rt/test/cfi/icall/wrong-signature-mixed-lto.c @@ -5,17 +5,17 @@ // RUN: %clang_cfi %s -DMODULE_A -c -o %t1_a.o // RUN: %clang_cfi %s -DMODULE_B -c -o %t1_b.o -flto // RUN: %clang_cfi %t1_a.o %t1_b.o -o %t1 -// RUN: %expect_crash %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t1 2>&1 | FileCheck --check-prefix=CFI %s // // RUN: %clang_cfi %s -DMODULE_A -c -o %t2_a.o -flto // RUN: %clang_cfi %s -DMODULE_B -c -o %t2_b.o // RUN: %clang_cfi %t2_a.o %t2_b.o -o %t2 -// RUN: %expect_crash %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t2 2>&1 | FileCheck --check-prefix=CFI %s // // RUN: %clang_cfi %s -DMODULE_A -c -o %t3_a.o // RUN: %clang_cfi %s -DMODULE_B -c -o %t3_b.o // RUN: %clang_cfi %t3_a.o %t3_b.o -o %t3 -// RUN: %expect_crash %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t3 2>&1 | FileCheck --check-prefix=CFI %s // // REQUIRES: thinlto Index: compiler-rt/test/cfi/lit.cfg.py =================================================================== --- compiler-rt/test/cfi/lit.cfg.py +++ compiler-rt/test/cfi/lit.cfg.py @@ -19,9 +19,9 @@ if config.cfi_lit_test_mode == "Devirt": config.available_features.add('devirt') clang_cfi += '-fwhole-program-vtables ' - config.substitutions.append((r"%expect_crash_unless_devirt ", "")) + config.substitutions.append((r"not --crash_unless_devirt ", "")) else: - config.substitutions.append((r"%expect_crash_unless_devirt ", config.expect_crash)) + config.substitutions.append((r"not --crash_unless_devirt ", config.expect_crash)) cxx = ' '.join(config.cxx_mode_flags) + ' ' diag = '-fno-sanitize-trap=cfi -fsanitize-recover=cfi ' Index: compiler-rt/test/cfi/mfcall.cpp =================================================================== --- compiler-rt/test/cfi/mfcall.cpp +++ compiler-rt/test/cfi/mfcall.cpp @@ -1,11 +1,11 @@ // UNSUPPORTED: windows-msvc // RUN: %clangxx_cfi -o %t %s -// RUN: %expect_crash %run %t a -// RUN: %expect_crash %run %t b -// RUN: %expect_crash %run %t c -// RUN: %expect_crash %run %t d -// RUN: %expect_crash %run %t e +// RUN: not --crash %run %t a +// RUN: not --crash %run %t b +// RUN: not --crash %run %t c +// RUN: not --crash %run %t d +// RUN: not --crash %run %t e // RUN: %run %t f // RUN: %run %t g Index: compiler-rt/test/cfi/multiple-inheritance.cpp =================================================================== --- compiler-rt/test/cfi/multiple-inheritance.cpp +++ compiler-rt/test/cfi/multiple-inheritance.cpp @@ -1,18 +1,18 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %run %t1 x 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 x 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %run %t2 x 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 x 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %run %t3 x 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 x 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s -// RUN: %expect_crash %run %t4 x 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 x 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -o %t5 %s // RUN: %run %t5 2>&1 | FileCheck --check-prefix=NCFI %s Index: compiler-rt/test/cfi/nvcall.cpp =================================================================== --- compiler-rt/test/cfi/nvcall.cpp +++ compiler-rt/test/cfi/nvcall.cpp @@ -1,14 +1,14 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -o %t5 %s // RUN: %run %t5 2>&1 | FileCheck --check-prefix=NCFI %s Index: compiler-rt/test/cfi/overwrite.cpp =================================================================== --- compiler-rt/test/cfi/overwrite.cpp +++ compiler-rt/test/cfi/overwrite.cpp @@ -1,14 +1,14 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash_unless_devirt %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash_unless_devirt %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -o %t5 %s // RUN: %run %t5 2>&1 | FileCheck --check-prefix=NCFI %s Index: compiler-rt/test/cfi/sibling.cpp =================================================================== --- compiler-rt/test/cfi/sibling.cpp +++ compiler-rt/test/cfi/sibling.cpp @@ -1,16 +1,16 @@ // XFAIL: * // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -o %t5 %s // RUN: %run %t5 2>&1 | FileCheck --check-prefix=NCFI %s Index: compiler-rt/test/cfi/simple-fail.cpp =================================================================== --- compiler-rt/test/cfi/simple-fail.cpp +++ compiler-rt/test/cfi/simple-fail.cpp @@ -1,50 +1,50 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -o %t5 %s -// RUN: %expect_crash %run %t5 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t5 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DB32 -o %t6 %s -// RUN: %expect_crash %run %t6 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t6 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DB64 -o %t7 %s -// RUN: %expect_crash %run %t7 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t7 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O1 -DBM -o %t8 %s -// RUN: %expect_crash %run %t8 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t8 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -o %t9 %s -// RUN: %expect_crash %run %t9 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t9 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DB32 -o %t10 %s -// RUN: %expect_crash %run %t10 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t10 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DB64 -o %t11 %s -// RUN: %expect_crash %run %t11 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t11 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O2 -DBM -o %t12 %s -// RUN: %expect_crash %run %t12 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t12 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -o %t13 %s -// RUN: %expect_crash %run %t13 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t13 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DB32 -o %t14 %s -// RUN: %expect_crash %run %t14 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t14 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DB64 -o %t15 %s -// RUN: %expect_crash %run %t15 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t15 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -O3 -DBM -o %t16 %s -// RUN: %expect_crash %run %t16 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t16 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi_diag -o %t17 %s // RUN: %run %t17 2>&1 | FileCheck --check-prefix=CFI-DIAG %s Index: compiler-rt/test/cfi/vdtor.cpp =================================================================== --- compiler-rt/test/cfi/vdtor.cpp +++ compiler-rt/test/cfi/vdtor.cpp @@ -1,14 +1,14 @@ // RUN: %clangxx_cfi -o %t1 %s -// RUN: %expect_crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t1 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB32 -o %t2 %s -// RUN: %expect_crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t2 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DB64 -o %t3 %s -// RUN: %expect_crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t3 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx_cfi -DBM -o %t4 %s -// RUN: %expect_crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %run %t4 2>&1 | FileCheck --check-prefix=CFI %s // RUN: %clangxx -o %t5 %s // RUN: %run %t5 2>&1 | FileCheck --check-prefix=NCFI %s Index: compiler-rt/test/gwp_asan/double_delete.cpp =================================================================== --- compiler-rt/test/gwp_asan/double_delete.cpp +++ compiler-rt/test/gwp_asan/double_delete.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Double Free at 0x{{[a-f0-9]+}} (a 1-byte allocation) Index: compiler-rt/test/gwp_asan/double_deletea.cpp =================================================================== --- compiler-rt/test/gwp_asan/double_deletea.cpp +++ compiler-rt/test/gwp_asan/double_deletea.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Double Free at 0x{{[a-f0-9]+}} (a 50-byte allocation) Index: compiler-rt/test/gwp_asan/double_free.cpp =================================================================== --- compiler-rt/test/gwp_asan/double_free.cpp +++ compiler-rt/test/gwp_asan/double_free.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s #include Index: compiler-rt/test/gwp_asan/heap_buffer_overflow.cpp =================================================================== --- compiler-rt/test/gwp_asan/heap_buffer_overflow.cpp +++ compiler-rt/test/gwp_asan/heap_buffer_overflow.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Buffer Overflow at 0x{{[a-f0-9]+}} ({{[1-9][0-9]*}} bytes to the right Index: compiler-rt/test/gwp_asan/heap_buffer_underflow.cpp =================================================================== --- compiler-rt/test/gwp_asan/heap_buffer_underflow.cpp +++ compiler-rt/test/gwp_asan/heap_buffer_underflow.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Buffer Underflow at 0x{{[a-f0-9]+}} (1 byte to the left Index: compiler-rt/test/gwp_asan/invalid_free_left.cpp =================================================================== --- compiler-rt/test/gwp_asan/invalid_free_left.cpp +++ compiler-rt/test/gwp_asan/invalid_free_left.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Invalid (Wild) Free at 0x{{[a-f0-9]+}} (1 byte to the left of a Index: compiler-rt/test/gwp_asan/invalid_free_right.cpp =================================================================== --- compiler-rt/test/gwp_asan/invalid_free_right.cpp +++ compiler-rt/test/gwp_asan/invalid_free_right.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Invalid (Wild) Free at 0x{{[a-f0-9]+}} (1 byte to the right of a Index: compiler-rt/test/gwp_asan/realloc.cpp =================================================================== --- compiler-rt/test/gwp_asan/realloc.cpp +++ compiler-rt/test/gwp_asan/realloc.cpp @@ -1,12 +1,12 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -DTEST_MALLOC -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-MALLOC +// RUN: not --crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-MALLOC // Check both C++98 and C. // RUN: %clangxx_gwp_asan -std=c++98 %s -o %t -DTEST_FREE -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-FREE +// RUN: not --crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-FREE // RUN: cp %s %t.c && %clang_gwp_asan %t.c -o %t -DTEST_FREE -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-FREE +// RUN: not --crash %run %t 2>&1 | FileCheck %s --check-prefix CHECK-FREE // Ensure GWP-ASan stub implementation of realloc() in Scudo works to-spec. In // particular, the behaviour regarding realloc of size zero is interesting, as Index: compiler-rt/test/gwp_asan/use_after_delete.cpp =================================================================== --- compiler-rt/test/gwp_asan/use_after_delete.cpp +++ compiler-rt/test/gwp_asan/use_after_delete.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Use After Free at 0x{{[a-f0-9]+}} (0 bytes into a 1-byte allocation Index: compiler-rt/test/gwp_asan/use_after_deletea.cpp =================================================================== --- compiler-rt/test/gwp_asan/use_after_deletea.cpp +++ compiler-rt/test/gwp_asan/use_after_deletea.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Use After Free at 0x{{[a-f0-9]+}} (0 bytes into a 10-byte allocation Index: compiler-rt/test/gwp_asan/use_after_free.cpp =================================================================== --- compiler-rt/test/gwp_asan/use_after_free.cpp +++ compiler-rt/test/gwp_asan/use_after_free.cpp @@ -1,6 +1,6 @@ // REQUIRES: gwp_asan // RUN: %clangxx_gwp_asan %s -o %t -// RUN: %expect_crash %run %t 2>&1 | FileCheck %s +// RUN: not --crash %run %t 2>&1 | FileCheck %s // CHECK: GWP-ASan detected a memory error // CHECK: Use After Free at 0x{{[a-f0-9]+}} (0 bytes into a 10-byte allocation Index: compiler-rt/test/lit.common.cfg.py =================================================================== --- compiler-rt/test/lit.common.cfg.py +++ compiler-rt/test/lit.common.cfg.py @@ -215,17 +215,6 @@ # Define %arch to check for architecture-dependent output. config.substitutions.append( ('%arch', (config.host_arch))) -if config.host_os == 'Windows': - # FIXME: This isn't quite right. Specifically, it will succeed if the program - # does not crash but exits with a non-zero exit code. We ought to merge - # KillTheDoctor and not --crash to make the latter more useful and remove the - # need for this substitution. - config.expect_crash = "not KillTheDoctor " -else: - config.expect_crash = "not --crash " - -config.substitutions.append( ("%expect_crash ", config.expect_crash) ) - target_arch = getattr(config, 'target_arch', None) if target_arch: config.available_features.add(target_arch + '-target-arch') Index: compiler-rt/test/profile/gcov-__gcov_flush-terminate.c =================================================================== --- compiler-rt/test/profile/gcov-__gcov_flush-terminate.c +++ compiler-rt/test/profile/gcov-__gcov_flush-terminate.c @@ -4,7 +4,7 @@ // RUN: %clang --coverage %s -o %t // RUN: test -f gcov-__gcov_flush-terminate.gcno -// RUN: rm -f gcov-__gcov_flush-terminate.gcda && %expect_crash %run %t +// RUN: rm -f gcov-__gcov_flush-terminate.gcda && not --crash %run %t // RUN: llvm-cov gcov -t gcov-__gcov_flush-terminate.gcda | FileCheck %s // CHECK: -: 0:Runs:1 Index: compiler-rt/test/ubsan/TestCases/Misc/bounds.cpp =================================================================== --- compiler-rt/test/ubsan/TestCases/Misc/bounds.cpp +++ compiler-rt/test/ubsan/TestCases/Misc/bounds.cpp @@ -1,7 +1,7 @@ // RUN: %clangxx -fsanitize=bounds %s -O3 -o %t // RUN: %run %t 0 0 0 // RUN: %run %t 1 2 3 -// RUN: %expect_crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2 +// RUN: not --crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2 // RUN: %run %t 0 3 0 2>&1 | FileCheck %s --check-prefix=CHECK-B-3 // RUN: %run %t 0 0 4 2>&1 | FileCheck %s --check-prefix=CHECK-C-4 Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ llvm/CMakeLists.txt @@ -1026,12 +1026,6 @@ add_subdirectory(utils/unittest) endif() - if (WIN32) - # This utility is used to prevent crashing tests from calling Dr. Watson on - # Windows. - add_subdirectory(utils/KillTheDoctor) - endif() - # Add a global check rule now that all subdirectories have been traversed # and we know the total set of lit testsuites. get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES) Index: llvm/utils/KillTheDoctor/CMakeLists.txt =================================================================== --- llvm/utils/KillTheDoctor/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_llvm_utility(KillTheDoctor - KillTheDoctor.cpp - ) - -target_link_libraries(KillTheDoctor - LLVMSupport - psapi - ) Index: llvm/utils/KillTheDoctor/KillTheDoctor.cpp =================================================================== --- llvm/utils/KillTheDoctor/KillTheDoctor.cpp +++ /dev/null @@ -1,556 +0,0 @@ -//===- KillTheDoctor - Prevent Dr. Watson from stopping tests ---*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This program provides an extremely hacky way to stop Dr. Watson from starting -// due to unhandled exceptions in child processes. -// -// This simply starts the program named in the first positional argument with -// the arguments following it under a debugger. All this debugger does is catch -// any unhandled exceptions thrown in the child process and close the program -// (and hopefully tells someone about it). -// -// This also provides another really hacky method to prevent assert dialog boxes -// from popping up. When --no-user32 is passed, if any process loads user32.dll, -// we assume it is trying to call MessageBoxEx and terminate it. The proper way -// to do this would be to actually set a break point, but there's quite a bit -// of code involved to get the address of MessageBoxEx in the remote process's -// address space due to Address space layout randomization (ASLR). This can be -// added if it's ever actually needed. -// -// If the subprocess exits for any reason other than successful termination, -1 -// is returned. If the process exits normally the value it returned is returned. -// -// I hate Windows. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/ADT/Twine.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/Signals.h" -#include "llvm/Support/WindowsError.h" -#include "llvm/Support/raw_ostream.h" -#include "llvm/Support/type_traits.h" -#include -#include -#include -#include -#include -#include - -// These includes must be last. -#include -#include -#include -#include - -using namespace llvm; - -#undef max - -namespace { - cl::opt ProgramToRun(cl::Positional, - cl::desc("")); - cl::list Argv(cl::ConsumeAfter, - cl::desc("...")); - cl::opt TraceExecution("x", - cl::desc("Print detailed output about what is being run to stderr.")); - cl::opt Timeout("t", cl::init(0), - cl::desc("Set maximum runtime in seconds. Defaults to infinite.")); - cl::opt NoUser32("no-user32", - cl::desc("Terminate process if it loads user32.dll.")); - - StringRef ToolName; - - template - class ScopedHandle { - typedef typename HandleType::handle_type handle_type; - - handle_type Handle; - - public: - ScopedHandle() - : Handle(HandleType::GetInvalidHandle()) {} - - explicit ScopedHandle(handle_type handle) - : Handle(handle) {} - - ~ScopedHandle() { - HandleType::Destruct(Handle); - } - - ScopedHandle& operator=(handle_type handle) { - // Cleanup current handle. - if (!HandleType::isValid(Handle)) - HandleType::Destruct(Handle); - Handle = handle; - return *this; - } - - operator bool() const { - return HandleType::isValid(Handle); - } - - operator handle_type() { - return Handle; - } - }; - - // This implements the most common handle in the Windows API. - struct CommonHandle { - typedef HANDLE handle_type; - - static handle_type GetInvalidHandle() { - return INVALID_HANDLE_VALUE; - } - - static void Destruct(handle_type Handle) { - ::CloseHandle(Handle); - } - - static bool isValid(handle_type Handle) { - return Handle != GetInvalidHandle(); - } - }; - - struct FileMappingHandle { - typedef HANDLE handle_type; - - static handle_type GetInvalidHandle() { - return NULL; - } - - static void Destruct(handle_type Handle) { - ::CloseHandle(Handle); - } - - static bool isValid(handle_type Handle) { - return Handle != GetInvalidHandle(); - } - }; - - struct MappedViewOfFileHandle { - typedef LPVOID handle_type; - - static handle_type GetInvalidHandle() { - return NULL; - } - - static void Destruct(handle_type Handle) { - ::UnmapViewOfFile(Handle); - } - - static bool isValid(handle_type Handle) { - return Handle != GetInvalidHandle(); - } - }; - - struct ProcessHandle : CommonHandle {}; - struct ThreadHandle : CommonHandle {}; - struct TokenHandle : CommonHandle {}; - struct FileHandle : CommonHandle {}; - - typedef ScopedHandle FileMappingScopedHandle; - typedef ScopedHandle MappedViewOfFileScopedHandle; - typedef ScopedHandle ProcessScopedHandle; - typedef ScopedHandle ThreadScopedHandle; - typedef ScopedHandle TokenScopedHandle; - typedef ScopedHandle FileScopedHandle; -} - -static std::error_code windows_error(DWORD E) { return mapWindowsError(E); } - -static std::error_code GetFileNameFromHandle(HANDLE FileHandle, - std::string &Name) { - char Filename[MAX_PATH+1]; - bool Success = false; - Name.clear(); - - // Get the file size. - LARGE_INTEGER FileSize; - Success = ::GetFileSizeEx(FileHandle, &FileSize); - - if (!Success) - return windows_error(::GetLastError()); - - // Create a file mapping object. - FileMappingScopedHandle FileMapping( - ::CreateFileMappingA(FileHandle, - NULL, - PAGE_READONLY, - 0, - 1, - NULL)); - - if (!FileMapping) - return windows_error(::GetLastError()); - - // Create a file mapping to get the file name. - MappedViewOfFileScopedHandle MappedFile( - ::MapViewOfFile(FileMapping, FILE_MAP_READ, 0, 0, 1)); - - if (!MappedFile) - return windows_error(::GetLastError()); - - Success = ::GetMappedFileNameA(::GetCurrentProcess(), - MappedFile, - Filename, - array_lengthof(Filename) - 1); - - if (!Success) - return windows_error(::GetLastError()); - else { - Name = Filename; - return std::error_code(); - } -} - -/// Find program using shell lookup rules. -/// @param Program This is either an absolute path, relative path, or simple a -/// program name. Look in PATH for any programs that match. If no -/// extension is present, try all extensions in PATHEXT. -/// @return If ec == errc::success, The absolute path to the program. Otherwise -/// the return value is undefined. -static std::string FindProgram(const std::string &Program, - std::error_code &ec) { - char PathName[MAX_PATH + 1]; - typedef SmallVector pathext_t; - pathext_t pathext; - // Check for the program without an extension (in case it already has one). - pathext.push_back(""); - SplitString(std::getenv("PATHEXT"), pathext, ";"); - - for (pathext_t::iterator i = pathext.begin(), e = pathext.end(); i != e; ++i){ - SmallString<5> ext; - for (std::size_t ii = 0, e = i->size(); ii != e; ++ii) - ext.push_back(::tolower((*i)[ii])); - LPCSTR Extension = NULL; - if (ext.size() && ext[0] == '.') - Extension = ext.c_str(); - DWORD length = ::SearchPathA(NULL, - Program.c_str(), - Extension, - array_lengthof(PathName), - PathName, - NULL); - if (length == 0) - ec = windows_error(::GetLastError()); - else if (length > array_lengthof(PathName)) { - // This may have been the file, return with error. - ec = windows_error(ERROR_BUFFER_OVERFLOW); - break; - } else { - // We found the path! Return it. - ec = std::error_code(); - break; - } - } - - // Make sure PathName is valid. - PathName[MAX_PATH] = 0; - return PathName; -} - -static StringRef ExceptionCodeToString(DWORD ExceptionCode) { - switch(ExceptionCode) { - case EXCEPTION_ACCESS_VIOLATION: return "EXCEPTION_ACCESS_VIOLATION"; - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - return "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"; - case EXCEPTION_BREAKPOINT: return "EXCEPTION_BREAKPOINT"; - case EXCEPTION_DATATYPE_MISALIGNMENT: - return "EXCEPTION_DATATYPE_MISALIGNMENT"; - case EXCEPTION_FLT_DENORMAL_OPERAND: return "EXCEPTION_FLT_DENORMAL_OPERAND"; - case EXCEPTION_FLT_DIVIDE_BY_ZERO: return "EXCEPTION_FLT_DIVIDE_BY_ZERO"; - case EXCEPTION_FLT_INEXACT_RESULT: return "EXCEPTION_FLT_INEXACT_RESULT"; - case EXCEPTION_FLT_INVALID_OPERATION: - return "EXCEPTION_FLT_INVALID_OPERATION"; - case EXCEPTION_FLT_OVERFLOW: return "EXCEPTION_FLT_OVERFLOW"; - case EXCEPTION_FLT_STACK_CHECK: return "EXCEPTION_FLT_STACK_CHECK"; - case EXCEPTION_FLT_UNDERFLOW: return "EXCEPTION_FLT_UNDERFLOW"; - case EXCEPTION_ILLEGAL_INSTRUCTION: return "EXCEPTION_ILLEGAL_INSTRUCTION"; - case EXCEPTION_IN_PAGE_ERROR: return "EXCEPTION_IN_PAGE_ERROR"; - case EXCEPTION_INT_DIVIDE_BY_ZERO: return "EXCEPTION_INT_DIVIDE_BY_ZERO"; - case EXCEPTION_INT_OVERFLOW: return "EXCEPTION_INT_OVERFLOW"; - case EXCEPTION_INVALID_DISPOSITION: return "EXCEPTION_INVALID_DISPOSITION"; - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - return "EXCEPTION_NONCONTINUABLE_EXCEPTION"; - case EXCEPTION_PRIV_INSTRUCTION: return "EXCEPTION_PRIV_INSTRUCTION"; - case EXCEPTION_SINGLE_STEP: return "EXCEPTION_SINGLE_STEP"; - case EXCEPTION_STACK_OVERFLOW: return "EXCEPTION_STACK_OVERFLOW"; - default: return ""; - } -} - -int main(int argc, char **argv) { - // Print a stack trace if we signal out. - sys::PrintStackTraceOnErrorSignal(argv[0]); - PrettyStackTraceProgram X(argc, argv); - llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. - - ToolName = argv[0]; - - cl::ParseCommandLineOptions(argc, argv, "Dr. Watson Assassin.\n"); - if (ProgramToRun.size() == 0) { - cl::PrintHelpMessage(); - return -1; - } - - if (Timeout > std::numeric_limits::max() / 1000) { - errs() << ToolName << ": Timeout value too large, must be less than: " - << std::numeric_limits::max() / 1000 - << '\n'; - return -1; - } - - std::string CommandLine(ProgramToRun); - - std::error_code ec; - ProgramToRun = FindProgram(ProgramToRun, ec); - if (ec) { - errs() << ToolName << ": Failed to find program: '" << CommandLine - << "': " << ec.message() << '\n'; - return -1; - } - - if (TraceExecution) - errs() << ToolName << ": Found Program: " << ProgramToRun << '\n'; - - for (const std::string &Arg : Argv) { - CommandLine.push_back(' '); - CommandLine.append(Arg); - } - - if (TraceExecution) - errs() << ToolName << ": Program Image Path: " << ProgramToRun << '\n' - << ToolName << ": Command Line: " << CommandLine << '\n'; - - STARTUPINFOA StartupInfo; - PROCESS_INFORMATION ProcessInfo; - std::memset(&StartupInfo, 0, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(StartupInfo); - std::memset(&ProcessInfo, 0, sizeof(ProcessInfo)); - - // Set error mode to not display any message boxes. The child process inherits - // this. - ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); - ::_set_error_mode(_OUT_TO_STDERR); - - BOOL success = ::CreateProcessA(ProgramToRun.c_str(), - const_cast(CommandLine.c_str()), - NULL, - NULL, - FALSE, - DEBUG_PROCESS, - NULL, - NULL, - &StartupInfo, - &ProcessInfo); - if (!success) { - errs() << ToolName << ": Failed to run program: '" << ProgramToRun << "': " - << std::error_code(windows_error(::GetLastError())).message() - << '\n'; - return -1; - } - - // Make sure ::CloseHandle is called on exit. - std::map ProcessIDToHandle; - - DEBUG_EVENT DebugEvent; - std::memset(&DebugEvent, 0, sizeof(DebugEvent)); - DWORD dwContinueStatus = DBG_CONTINUE; - - // Run the program under the debugger until either it exits, or throws an - // exception. - if (TraceExecution) - errs() << ToolName << ": Debugging...\n"; - - while(true) { - DWORD TimeLeft = INFINITE; - if (Timeout > 0) { - FILETIME CreationTime, ExitTime, KernelTime, UserTime; - ULARGE_INTEGER a, b; - success = ::GetProcessTimes(ProcessInfo.hProcess, - &CreationTime, - &ExitTime, - &KernelTime, - &UserTime); - if (!success) { - ec = windows_error(::GetLastError()); - - errs() << ToolName << ": Failed to get process times: " - << ec.message() << '\n'; - return -1; - } - a.LowPart = KernelTime.dwLowDateTime; - a.HighPart = KernelTime.dwHighDateTime; - b.LowPart = UserTime.dwLowDateTime; - b.HighPart = UserTime.dwHighDateTime; - // Convert 100-nanosecond units to milliseconds. - uint64_t TotalTimeMiliseconds = (a.QuadPart + b.QuadPart) / 10000; - // Handle the case where the process has been running for more than 49 - // days. - if (TotalTimeMiliseconds > std::numeric_limits::max()) { - errs() << ToolName << ": Timeout Failed: Process has been running for" - "more than 49 days.\n"; - return -1; - } - - // We check with > instead of using Timeleft because if - // TotalTimeMiliseconds is greater than Timeout * 1000, TimeLeft would - // underflow. - if (TotalTimeMiliseconds > (Timeout * 1000)) { - errs() << ToolName << ": Process timed out.\n"; - ::TerminateProcess(ProcessInfo.hProcess, -1); - // Otherwise other stuff starts failing... - return -1; - } - - TimeLeft = (Timeout * 1000) - static_cast(TotalTimeMiliseconds); - } - success = WaitForDebugEvent(&DebugEvent, TimeLeft); - - if (!success) { - DWORD LastError = ::GetLastError(); - ec = windows_error(LastError); - - if (LastError == ERROR_SEM_TIMEOUT || LastError == WSAETIMEDOUT) { - errs() << ToolName << ": Process timed out.\n"; - ::TerminateProcess(ProcessInfo.hProcess, -1); - // Otherwise other stuff starts failing... - return -1; - } - - errs() << ToolName << ": Failed to wait for debug event in program: '" - << ProgramToRun << "': " << ec.message() << '\n'; - return -1; - } - - switch(DebugEvent.dwDebugEventCode) { - case CREATE_PROCESS_DEBUG_EVENT: - // Make sure we remove the handle on exit. - if (TraceExecution) - errs() << ToolName << ": Debug Event: CREATE_PROCESS_DEBUG_EVENT\n"; - ProcessIDToHandle[DebugEvent.dwProcessId] = - DebugEvent.u.CreateProcessInfo.hProcess; - ::CloseHandle(DebugEvent.u.CreateProcessInfo.hFile); - break; - case EXIT_PROCESS_DEBUG_EVENT: { - if (TraceExecution) - errs() << ToolName << ": Debug Event: EXIT_PROCESS_DEBUG_EVENT\n"; - - // If this is the process we originally created, exit with its exit - // code. - if (DebugEvent.dwProcessId == ProcessInfo.dwProcessId) - return DebugEvent.u.ExitProcess.dwExitCode; - - // Otherwise cleanup any resources we have for it. - std::map::iterator ExitingProcess = - ProcessIDToHandle.find(DebugEvent.dwProcessId); - if (ExitingProcess == ProcessIDToHandle.end()) { - errs() << ToolName << ": Got unknown process id!\n"; - return -1; - } - ::CloseHandle(ExitingProcess->second); - ProcessIDToHandle.erase(ExitingProcess); - } - break; - case CREATE_THREAD_DEBUG_EVENT: - ::CloseHandle(DebugEvent.u.CreateThread.hThread); - break; - case LOAD_DLL_DEBUG_EVENT: { - // Cleanup the file handle. - FileScopedHandle DLLFile(DebugEvent.u.LoadDll.hFile); - std::string DLLName; - ec = GetFileNameFromHandle(DLLFile, DLLName); - if (ec) { - DLLName = " : "; - DLLName += ec.message(); - } - if (TraceExecution) { - errs() << ToolName << ": Debug Event: LOAD_DLL_DEBUG_EVENT\n"; - errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n'; - } - - if (NoUser32 && sys::path::stem(DLLName) == "user32") { - // Program is loading user32.dll, in the applications we are testing, - // this only happens if an assert has fired. By now the message has - // already been printed, so simply close the program. - errs() << ToolName << ": user32.dll loaded!\n"; - errs().indent(ToolName.size()) - << ": This probably means that assert was called. Closing " - "program to prevent message box from popping up.\n"; - dwContinueStatus = DBG_CONTINUE; - ::TerminateProcess(ProcessIDToHandle[DebugEvent.dwProcessId], -1); - return -1; - } - } - break; - case EXCEPTION_DEBUG_EVENT: { - // Close the application if this exception will not be handled by the - // child application. - if (TraceExecution) - errs() << ToolName << ": Debug Event: EXCEPTION_DEBUG_EVENT\n"; - - EXCEPTION_DEBUG_INFO &Exception = DebugEvent.u.Exception; - if (Exception.dwFirstChance > 0) { - if (TraceExecution) { - errs().indent(ToolName.size()) << ": Debug Info : "; - errs() << "First chance exception at " - << Exception.ExceptionRecord.ExceptionAddress - << ", exception code: " - << ExceptionCodeToString( - Exception.ExceptionRecord.ExceptionCode) - << " (" << Exception.ExceptionRecord.ExceptionCode << ")\n"; - } - dwContinueStatus = DBG_EXCEPTION_NOT_HANDLED; - } else { - errs() << ToolName << ": Unhandled exception in: " << ProgramToRun - << "!\n"; - errs().indent(ToolName.size()) << ": location: "; - errs() << Exception.ExceptionRecord.ExceptionAddress - << ", exception code: " - << ExceptionCodeToString( - Exception.ExceptionRecord.ExceptionCode) - << " (" << Exception.ExceptionRecord.ExceptionCode - << ")\n"; - dwContinueStatus = DBG_CONTINUE; - ::TerminateProcess(ProcessIDToHandle[DebugEvent.dwProcessId], -1); - return -1; - } - } - break; - default: - // Do nothing. - if (TraceExecution) - errs() << ToolName << ": Debug Event: \n"; - break; - } - - success = ContinueDebugEvent(DebugEvent.dwProcessId, - DebugEvent.dwThreadId, - dwContinueStatus); - if (!success) { - ec = windows_error(::GetLastError()); - errs() << ToolName << ": Failed to continue debugging program: '" - << ProgramToRun << "': " << ec.message() << '\n'; - return -1; - } - - dwContinueStatus = DBG_CONTINUE; - } - - assert(0 && "Fell out of debug loop. This shouldn't be possible!"); - return -1; -}