1 | // RUN: %clangxx_memprof -O0 %s -o %t && %env_memprof_opts=print_text=true:log_path=stderr %run %t 2>&1 | FileCheck %s |
---|---|
2 | |
3 | // This is actually: |
4 | // Memory allocation stack id = STACKID |
5 | // alloc_count 1, size (ave/min/max) 128.00 / 128 / 128 |
6 | // but we need to look for them in the same CHECK to get the correct STACKID. |
7 | // CHECK: Memory allocation stack id = [[STACKID:[0-9]+]]{{[[:space:]].*}}alloc_count 1, size (ave/min/max) 128.00 / 128 / 128 |
8 | // CHECK-NEXT: access_count (ave/min/max): 22.00 / 22 / 22 |
9 | |
10 | #include <sanitizer/memprof_interface.h> |
11 | |
12 | #include <stdlib.h> |
13 | #include <string.h> |
14 | int main(int argc, char **argv) { |
15 | // CHECK: Stack for id [[STACKID]]: |
16 | // CHECK-NEXT: #0 {{.*}} in operator new[](unsigned long) |
17 | // CHECK-NEXT: #1 {{.*}} in main {{.*}}:[[@LINE+1]] |
18 | char *x = new char[128]; |
19 | memset(s: x, c: 0xab, n: 128); |
20 | __sanitizer_unaligned_load16(p: x + 15); |
21 | __sanitizer_unaligned_load32(p: x + 15); |
22 | __sanitizer_unaligned_load64(p: x + 15); |
23 | |
24 | __sanitizer_unaligned_store16(p: x + 15, x: 0); |
25 | __sanitizer_unaligned_store32(p: x + 15, x: 0); |
26 | __sanitizer_unaligned_store64(p: x + 15, x: 0); |
27 | |
28 | delete[] x; |
29 | return 0; |
30 | } |
31 |