Home | History | Annotate | Download | only in Linux
      1 // Test the handle_sigill option.
      2 // RUN: %clang %s -o %t -O1
      3 // RUN:                                not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
      4 // RUN: %env_tool_opts=handle_sigill=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
      5 // RUN: %env_tool_opts=handle_sigill=1 not         %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
      6 // FIXME: implement in other sanitizers, not just asan.
      7 // XFAIL: msan
      8 // XFAIL: lsan
      9 // XFAIL: tsan
     10 //
     11 // FIXME: seems to fail on ARM
     12 // REQUIRES: x86_64-supported-target
     13 #include <assert.h>
     14 #include <stdio.h>
     15 #include <sanitizer/asan_interface.h>
     16 
     17 void death() {
     18   fprintf(stderr, "DEATH CALLBACK\n");
     19 }
     20 
     21 int main(int argc, char **argv) {
     22   __sanitizer_set_death_callback(death);
     23   __builtin_trap();
     24 }
     25 // CHECK1: ERROR: {{.*}}Sanitizer:
     26 // CHECK1: DEATH CALLBACK
     27 // CHECK0-NOT: Sanitizer
     28