void* VG_WRAP_FUNCTION_ZZ(dyld, ZuZZN4dyld18fastBindLazySymbolEPP11ImageLoaderm) (void** imageLoaderCache, uintptr_t lazyBindingInfoOffset) { void* res; OrigFn fn; VALGRIND_GET_ORIG_FN(fn); ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); CALL_FN_W_WW(res, fn, imageLoaderCache, lazyBindingInfoOffset); ANNOTATE_IGNORE_READS_AND_WRITES_END(); return res; }
static __always_inline int pthread_once_intercept(pthread_once_t *once_control, void (*init_routine)(void)) { int ret; OrigFn fn; VALGRIND_GET_ORIG_FN(fn); /* * Ignore any data races triggered by the implementation of pthread_once(). * Necessary for Darwin. This is not necessary for Linux but doesn't have * any known adverse effects. */ DRD_IGNORE_VAR(*once_control); ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); CALL_FN_W_WW(ret, fn, once_control, init_routine); ANNOTATE_IGNORE_READS_AND_WRITES_END(); DRD_STOP_IGNORING_VAR(*once_control); return ret; }
int main(int argc, char** argv) { int optchar; int ign_rw = 1; pthread_t tid; while ((optchar = getopt(argc, argv, "r")) != EOF) { switch (optchar) { case 'r': ign_rw = 0; break; default: assert(0); } } pthread_create(&tid, 0, thread_func, 0); if (ign_rw) ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); /* Read s_b and modify s_a. */ s_a = s_b; if (ign_rw) ANNOTATE_IGNORE_READS_AND_WRITES_END(); /* * Insert a delay here in order to make sure the load of s_c happens * after s_c has been modified. */ sleep(1); /* Read s_c. */ fprintf(stderr, "%s", "x" + s_c); pthread_join(tid, 0); fprintf(stderr, "Finished.\n"); return 0; }
static __always_inline int pthread_join_intercept(pthread_t pt_joinee, void **thread_return) { int ret; OrigFn fn; VALGRIND_GET_ORIG_FN(fn); /* * Avoid that the sys_futex(td->tid) call invoked by the NPTL pthread_join() * implementation triggers a (false positive) race report. */ ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN(); CALL_FN_W_WW(ret, fn, pt_joinee, thread_return); if (ret == 0) { VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__POST_THREAD_JOIN, pt_joinee, 0, 0, 0, 0); } ANNOTATE_IGNORE_READS_AND_WRITES_END(); return ret; }