1 // Check that ASan dumps the CPU registers on a SIGSEGV.
3 // RUN: %clangxx_asan %s -o %t
4 // RUN: not %run %t 2>&1 | FileCheck %s
11 fprintf(stderr
, "Hello\n");
14 ptr
= (char *)mmap(NULL
, 0x10000, PROT_NONE
, MAP_ANON
| MAP_PRIVATE
, -1, 0);
15 assert(ptr
&& "failed to mmap");
17 fprintf(stderr
, sizeof(uintptr_t) == 8 ? "p = 0x%016lx\n" : "p = 0x%08lx\n", (uintptr_t)ptr
);
18 // CHECK: p = [[ADDR:0x[0-9]+]]
20 char c
= *ptr
; // BOOM
21 // CHECK: ERROR: AddressSanitizer: {{SEGV|BUS}}
22 // CHECK: Register values:
24 fprintf(stderr
, "World\n");