| 1 | // UNSUPPORTED: ios |
| 2 | // We can reduce the scope of this test to check that we set the crash reporter |
| 3 | // buffers correctly instead of reading from the crashlog. |
| 4 | // For now, disable this test. |
| 5 | // REQUIRES: rdar_74544282 |
| 6 | // REQUIRES: expensive |
| 7 | // Check that ASan reports on OS X actually crash the process (abort_on_error=1) |
| 8 | // and that crash is logged via the crash reporter with ASan logs in the |
| 9 | // Application Specific Information section of the log. |
| 10 | |
| 11 | // RUN: %clangxx_asan %s -o %t |
| 12 | |
| 13 | // crash hard so the crashlog is created. |
| 14 | // RUN: %env_asan_opts=abort_on_error=1 not --crash %run %t > %t.process_output.txt 2>&1 |
| 15 | // RUN: %print_crashreport_for_pid --binary-filename=%basename_t.tmp \ |
| 16 | // RUN: --pid=$(%get_pid_from_output --infile=%t.process_output.txt) \ |
| 17 | // RUN: | FileCheck %s --check-prefixes CHECK-CRASHLOG |
| 18 | |
| 19 | #include <stdlib.h> |
| 20 | int main() { |
| 21 | char *x = (char *)malloc(size: 10 * sizeof(char)); |
| 22 | free(ptr: x); |
| 23 | return x[5]; |
| 24 | // needs to crash hard so the crashlog exists... |
| 25 | // CHECK-CRASHLOG: {{.*Application Specific Information:}} |
| 26 | // CHECK-CRASHLOG-NEXT: {{=====}} |
| 27 | // CHECK-CRASHLOG-NEXT: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} |
| 28 | // CHECK-CRASHLOG: {{abort()}} |
| 29 | } |
| 30 | |