]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
DRD, Darwin: avoid triggering misaligned stack errors. Fixes #267552.
authorBart Van Assche <bvanassche@acm.org>
Sat, 5 Mar 2011 14:51:24 +0000 (14:51 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 5 Mar 2011 14:51:24 +0000 (14:51 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11591

drd/drd_pthread_intercepts.c

index 44da42dee0a1b5db5ac90810fe9398f9285ce5a2..57a82fddf66be93d978526d0b5953e58f010b7b4 100644 (file)
  * @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