1//===-- test.c ------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// Sanity test for Go runtime. 11// 12//===----------------------------------------------------------------------===// 13 14#include <stdio.h> 15
| 1//===-- test.c ------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// Sanity test for Go runtime. 11// 12//===----------------------------------------------------------------------===// 13 14#include <stdio.h> 15
|
16void __tsan_init();
| 16void __tsan_init(void **thr);
|
17void __tsan_fini(); 18void __tsan_map_shadow(void *addr, unsigned long size);
| 17void __tsan_fini(); 18void __tsan_map_shadow(void *addr, unsigned long size);
|
19void __tsan_go_start(int pgoid, int chgoid, void *pc); 20void __tsan_go_end(int goid); 21void __tsan_read(int goid, void *addr, void *pc); 22void __tsan_write(int goid, void *addr, void *pc); 23void __tsan_func_enter(int goid, void *pc); 24void __tsan_func_exit(int goid); 25void __tsan_malloc(int goid, void *p, unsigned long sz, void *pc);
| 19void __tsan_go_start(void *thr, void **chthr, void *pc); 20void __tsan_go_end(void *thr); 21void __tsan_read(void *thr, void *addr, void *pc); 22void __tsan_write(void *thr, void *addr, void *pc); 23void __tsan_func_enter(void *thr, void *pc); 24void __tsan_func_exit(void *thr); 25void __tsan_malloc(void *thr, void *p, unsigned long sz, void *pc);
|
26void __tsan_free(void *p);
| 26void __tsan_free(void *p);
|
27void __tsan_acquire(int goid, void *addr); 28void __tsan_release(int goid, void *addr); 29void __tsan_release_merge(int goid, void *addr);
| 27void __tsan_acquire(void *thr, void *addr); 28void __tsan_release(void *thr, void *addr); 29void __tsan_release_merge(void *thr, void *addr);
|
30 31int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) { 32 return 0; 33} 34 35char buf[10]; 36 37int main(void) {
| 30 31int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) { 32 return 0; 33} 34 35char buf[10]; 36 37int main(void) {
|
38 __tsan_init();
| 38 void *thr0 = 0; 39 __tsan_init(&thr0);
|
39 __tsan_map_shadow(buf, sizeof(buf) + 4096);
| 40 __tsan_map_shadow(buf, sizeof(buf) + 4096);
|
40 __tsan_func_enter(0, &main); 41 __tsan_malloc(0, buf, 10, 0); 42 __tsan_release(0, buf); 43 __tsan_release_merge(0, buf); 44 __tsan_go_start(0, 1, 0); 45 __tsan_write(1, buf, 0); 46 __tsan_acquire(1, buf); 47 __tsan_go_end(1); 48 __tsan_read(0, buf, 0);
| 41 __tsan_func_enter(thr0, &main); 42 __tsan_malloc(thr0, buf, 10, 0); 43 __tsan_release(thr0, buf); 44 __tsan_release_merge(thr0, buf); 45 void *thr1 = 0; 46 __tsan_go_start(thr0, &thr1, 0); 47 __tsan_write(thr1, buf, 0); 48 __tsan_acquire(thr1, buf); 49 __tsan_go_end(thr1); 50 __tsan_read(thr0, buf, 0);
|
49 __tsan_free(buf);
| 51 __tsan_free(buf);
|
50 __tsan_func_exit(0);
| 52 __tsan_func_exit(thr0);
|
51 __tsan_fini(); 52 return 0; 53}
| 53 __tsan_fini(); 54 return 0; 55}
|