]>
Commit | Line | Data |
---|---|---|
7cac9316 XL |
1 | // Check that ASan dumps the CPU registers on a SIGSEGV. |
2 | ||
3 | // RUN: %clangxx_asan %s -o %t | |
4 | // RUN: not %run %t 2>&1 | FileCheck %s | |
5 | ||
6 | #include <assert.h> | |
7 | #include <stdio.h> | |
8 | ||
9 | int main() { | |
10 | fprintf(stderr, "Hello\n"); | |
11 | char *ptr; | |
12 | ||
13 | if (sizeof(void *) == 8) | |
14 | ptr = (char *)0x6666666666666666; | |
15 | else if (sizeof(void *) == 4) | |
16 | ptr = (char *)0x55555555; | |
17 | else | |
18 | assert(0 && "Your computer is weird."); | |
19 | ||
20 | char c = *ptr; // BOOM | |
21 | // CHECK: ERROR: AddressSanitizer: SEGV | |
22 | // CHECK: Register values: | |
23 | // CHECK: {{0x55555555|0x6666666666666666}} | |
24 | fprintf(stderr, "World\n"); | |
25 | return c; | |
26 | } |