示例#1
0
int main(void) {
  void *thr0 = 0;
  __tsan_init(&thr0, symbolize_cb);
  char *buf = (char*)((unsigned long)buf0 + (64<<10) - 1 & ~((64<<10) - 1));
  __tsan_map_shadow(buf, 4096);
  __tsan_malloc(thr0, (char*)&barfoo + 1, buf, 10);
  __tsan_free(thr0, buf, 10);
  __tsan_func_enter(thr0, (char*)&main + 1);
  __tsan_malloc(thr0, (char*)&barfoo + 1, buf, 10);
  __tsan_release(thr0, buf);
  __tsan_release_merge(thr0, buf);
  void *thr1 = 0;
  __tsan_go_start(thr0, &thr1, (char*)&barfoo + 1);
  void *thr2 = 0;
  __tsan_go_start(thr0, &thr2, (char*)&barfoo + 1);
  __tsan_func_enter(thr1, (char*)&foobar + 1);
  __tsan_func_enter(thr1, (char*)&foobar + 1);
  __tsan_write(thr1, buf, (char*)&barfoo + 1);
  __tsan_acquire(thr1, buf);
  __tsan_func_exit(thr1);
  __tsan_func_exit(thr1);
  __tsan_go_end(thr1);
  __tsan_func_enter(thr2, (char*)&foobar + 1);
  __tsan_read(thr2, buf, (char*)&barfoo + 1);
  __tsan_func_exit(thr2);
  __tsan_go_end(thr2);
  __tsan_func_exit(thr0);
  __tsan_fini();
  return 0;
}
int main(void) {
  void *thr0 = 0;
  __tsan_init(&thr0);
  __tsan_map_shadow(buf, sizeof(buf) + 4096);
  __tsan_func_enter(thr0, (char*)&main + 1);
  __tsan_malloc(thr0, buf, 10, 0);
  __tsan_release(thr0, buf);
  __tsan_release_merge(thr0, buf);
  void *thr1 = 0;
  __tsan_go_start(thr0, &thr1, (char*)&barfoo + 1);
  void *thr2 = 0;
  __tsan_go_start(thr0, &thr2, (char*)&barfoo + 1);
  __tsan_func_enter(thr1, (char*)&foobar + 1);
  __tsan_func_enter(thr1, (char*)&foobar + 1);
  __tsan_write(thr1, buf, (char*)&barfoo + 1);
  __tsan_acquire(thr1, buf);
  __tsan_func_exit(thr1);
  __tsan_func_exit(thr1);
  __tsan_go_end(thr1);
  __tsan_func_enter(thr2, (char*)&foobar + 1);
  __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;
}
示例#3
0
文件: test.c 项目: anurse/CompilerRT
int main(void) {
  __tsan_init();
  __tsan_map_shadow(buf, sizeof(buf) + 4096);
  __tsan_func_enter(0, &main);
  __tsan_malloc(0, buf, 10, 0);
  __tsan_release(0, buf);
  __tsan_release_merge(0, buf);
  __tsan_go_start(0, 1, 0);
  __tsan_write(1, buf, 0);
  __tsan_acquire(1, buf);
  __tsan_go_end(1);
  __tsan_read(0, buf, 0);
  __tsan_free(buf);
  __tsan_func_exit(0);
  __tsan_fini();
  return 0;
}