1 // RUN: %clangxx_tsan -O0 %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s
7 extern "C" const char *
8 __tsan_locate_address(void *addr
, char *name
, size_t name_size
,
9 void **region_address_ptr
, size_t *region_size_ptr
);
15 void *heap_var
= malloc(10);
17 fprintf(stderr
, "stack_var = %p\n", &stack_var
);
18 fprintf(stderr
, "global_var = %p\n", &global_var
);
19 fprintf(stderr
, "heap_var = %p\n", heap_var
);
20 // CHECK: stack_var = [[STACK_VAR:0x[0-9a-f]+]]
21 // CHECK: global_var = [[GLOBAL_VAR:0x[0-9a-f]+]]
22 // CHECK: heap_var = [[HEAP_VAR:0x[0-9a-f]+]]
28 type
= __tsan_locate_address(&stack_var
, name
, 128, &start
, &size
);
29 fprintf(stderr
, "type: %s\n", type
);
32 type
= __tsan_locate_address(&global_var
, name
, 128, &start
, &size
);
33 fprintf(stderr
, "type: %s, name = %s, start = %p, size = %zu\n", type
, name
,
35 // CHECK: type: global, name = global_var, start = [[GLOBAL_VAR]], size = {{8|0}}
37 type
= __tsan_locate_address(heap_var
, name
, 128, &start
, &size
);
38 fprintf(stderr
, "type: %s, start = %p, size = %zu\n", type
, start
, size
);
39 // CHECK: type: heap, start = [[HEAP_VAR]], size = 10