diff options
Diffstat (limited to 'lib/tsan/go/test.c')
-rw-r--r-- | lib/tsan/go/test.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/tsan/go/test.c b/lib/tsan/go/test.c index 859b35d348e89..94433f1b8c221 100644 --- a/lib/tsan/go/test.c +++ b/lib/tsan/go/test.c @@ -13,7 +13,7 @@ #include <stdio.h> -void __tsan_init(void **thr); +void __tsan_init(void **thr, void (*cb)(void*)); void __tsan_fini(); void __tsan_map_shadow(void *addr, unsigned long size); void __tsan_go_start(void *thr, void **chthr, void *pc); @@ -22,27 +22,26 @@ void __tsan_read(void *thr, void *addr, void *pc); void __tsan_write(void *thr, void *addr, void *pc); void __tsan_func_enter(void *thr, void *pc); void __tsan_func_exit(void *thr); -void __tsan_malloc(void *thr, void *p, unsigned long sz, void *pc); -void __tsan_free(void *p); +void __tsan_malloc(void *p, unsigned long sz); void __tsan_acquire(void *thr, void *addr); void __tsan_release(void *thr, void *addr); void __tsan_release_merge(void *thr, void *addr); -int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) { - return 0; -} +void symbolize_cb(void *ctx) {} -char buf[10]; +char buf0[100<<10]; void foobar() {} void barfoo() {} int main(void) { void *thr0 = 0; - __tsan_init(&thr0); - __tsan_map_shadow(buf, sizeof(buf) + 4096); + char *buf = (char*)((unsigned long)buf0 + (64<<10) - 1 & ~((64<<10) - 1)); + __tsan_malloc(buf, 10); + __tsan_init(&thr0, symbolize_cb); + __tsan_map_shadow(buf, 4096); __tsan_func_enter(thr0, (char*)&main + 1); - __tsan_malloc(thr0, buf, 10, 0); + __tsan_malloc(buf, 10); __tsan_release(thr0, buf); __tsan_release_merge(thr0, buf); void *thr1 = 0; @@ -60,7 +59,6 @@ int main(void) { __tsan_read(thr2, buf, (char*)&barfoo + 1); __tsan_func_exit(thr2); __tsan_go_end(thr2); - __tsan_free(buf); __tsan_func_exit(thr0); __tsan_fini(); return 0; |