|
From: <sv...@va...> - 2011-03-05 14:51:35
|
Author: bart
Date: 2011-03-05 14:51:24 +0000 (Sat, 05 Mar 2011)
New Revision: 11591
Log:
DRD, Darwin: avoid triggering misaligned stack errors. Fixes #267552.
Modified:
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2011-03-05 14:49:12 UTC (rev 11590)
+++ trunk/drd/drd_pthread_intercepts.c 2011-03-05 14:51:24 UTC (rev 11591)
@@ -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
|