]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
DRD: Added a (non-functional so far) file drd_darwin_intercepts.c.
authorBart Van Assche <bvanassche@acm.org>
Sun, 6 Mar 2011 12:39:12 +0000 (12:39 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 6 Mar 2011 12:39:12 +0000 (12:39 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11596

drd/Makefile.am
drd/drd_darwin_intercepts.c [new file with mode: 0644]

index edfd7deaef60fbed0b2b8f6189b71fa6ad8a8932..6295fbd0e0fb9b1d3467e1fd001d2983763c6e0f 100644 (file)
@@ -127,6 +127,10 @@ VGPRELOAD_DRD_SOURCES_COMMON = \
   drd_qtcore_intercepts.c      \
   drd_strmem_intercepts.c
 
+if VGCONF_OS_IS_DARWIN
+VGPRELOAD_DRD_SOURCES_COMMON += drd_darwin_intercepts.c
+endif
+
 vgpreload_drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES      = \
        $(VGPRELOAD_DRD_SOURCES_COMMON)
 vgpreload_drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS     = \
diff --git a/drd/drd_darwin_intercepts.c b/drd/drd_darwin_intercepts.c
new file mode 100644 (file)
index 0000000..eae2552
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdint.h>
+#include <stdio.h>
+#include "valgrind.h"
+#include "pub_tool_redir.h"
+
+#if 0
+
+/*
+ * On Mac OS X shared library functions are lazily bound. The binding mechanism
+ * uses self-modifying code. Intercept dyld_stub_binder() in order to suppress
+ * the data accesses involved in this mechanism.
+ *
+ * See also the Mac OS X ABI Dynamic Loader Reference (http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/MachOReference/Reference/reference.html#//apple_ref/c/func/dyld_stub_binding_helper).
+ * See also the dyld_stub_binder() source code (http://www.opensource.apple.com/source/dyld/dyld-132.13/src/dyld_stub_binder.s).
+ */
+void* VG_WRAP_FUNCTION_ZZ(libSystemZdZaZddylib, dyldZustubZubinder)
+     (void** imageLoaderCache, uintptr_t lazyBindingInfoOffset);
+void* VG_WRAP_FUNCTION_ZZ(libSystemZdZaZddylib, dyldZustubZubinder)
+     (void** imageLoaderCache, uintptr_t lazyBindingInfoOffset)
+{
+  void* res;
+  OrigFn fn;
+  
+  VALGRIND_GET_ORIG_FN(fn);
+
+  CALL_FN_W_WW(res, fn, imageLoaderCache, lazyBindingInfoOffset);
+
+  return res;
+}
+
+#endif