From: Bart Van Assche Date: Fri, 2 May 2008 18:53:33 +0000 (+0000) Subject: Postponed call of vg_set_main_thread_state() from /lib/ld-*.so:_start() to the call... X-Git-Tag: svn/VALGRIND_3_4_0~646 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79247715a5c4965721331117240577a04fb56374;p=thirdparty%2Fvalgrind.git Postponed call of vg_set_main_thread_state() from /lib/ld-*.so:_start() to the call of main(), the program entry point. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7991 --- diff --git a/exp-drd/drd_pthread_intercepts.c b/exp-drd/drd_pthread_intercepts.c index 5b28d6728c..f64ab1c535 100644 --- a/exp-drd/drd_pthread_intercepts.c +++ b/exp-drd/drd_pthread_intercepts.c @@ -97,7 +97,6 @@ static void vg_set_main_thread_state(void); static void init(void) { check_threading_library(); - vg_set_main_thread_state(); /* glibc up to and including version 2.7 triggers conflicting accesses */ /* on stdout and stderr when sending output to one of these streams from */ /* more than one thread. Suppress data race reports on these objects. */ @@ -105,6 +104,17 @@ static void init(void) DRD_IGNORE_VAR(*stderr); } +int VG_WRAP_FUNCTION_ZZ(Za,main)(int argc, char** argv, char** envp); +int VG_WRAP_FUNCTION_ZZ(Za,main)(int argc, char** argv, char** envp) +{ + int ret; + OrigFn fn; + VALGRIND_GET_ORIG_FN(fn); + vg_set_main_thread_state(); + CALL_FN_W_WWW(ret, fn, argc, argv, envp); + return ret; +} + static MutexT pthread_to_drd_mutex_type(const int kind) { switch (kind)