From: Bart Van Assche Date: Sat, 5 Mar 2011 14:51:24 +0000 (+0000) Subject: DRD, Darwin: avoid triggering misaligned stack errors. Fixes #267552. X-Git-Tag: svn/VALGRIND_3_7_0~638 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bcd0bc21559c42e2ce7f48344b950fe51b23ac97;p=thirdparty%2Fvalgrind.git DRD, Darwin: avoid triggering misaligned stack errors. Fixes #267552. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11591 --- diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index 44da42dee0..57a82fddf6 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -87,10 +87,25 @@ * @param[in] arg_decl Argument declaration list enclosed in parentheses. * @param[in] argl Argument list enclosed in parentheses. */ +#ifdef VGO_darwin +static int never_true; +#define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl) \ + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl; \ + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ + { \ + ret_ty pth_func_result = implf argl; \ + /* Apparently inserting a function call in wrapper functions */ \ + /* is sufficient to avoid misaligned stack errors. */ \ + if (never_true) \ + fflush(stdout); \ + return pth_func_result; \ + } +#else #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl) \ ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl; \ ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ { return implf argl; } +#endif /** * Macro for generating three Valgrind interception functions: one with the