Darwin only: don't tell aspacemgr about the kernel commpage -- only
tell the tool.  This is because telling the aspacemgr about it causes
the sync checker to fail entirely on Darwin.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14137 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c
index d876ddd..60f74b9 100644
--- a/coregrind/m_initimg/initimg-darwin.c
+++ b/coregrind/m_initimg/initimg-darwin.c
@@ -486,6 +486,15 @@
 
 static void record_system_memory(void)
 {
+  /* JRS 2014-Jul-08: this messes up the sync checker, because the
+     information that the kernel gives us doesn't include anything
+     about the commpage mapping.  This functionality has therefore
+     been moved to m_main.c, valgrind_main(), section "Tell the tool
+     about the initial client memory permissions".  See comments there
+     for rationale. */
+   return;
+   /*NOTREACHED*/
+
    /* Tell aspacem where the client's kernel commpage is */
 #if defined(VGA_amd64)
    /* commpage 0x7fff:ffe00000+ - not in vm_region */
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 4485f03..7641e8c 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2301,6 +2301,24 @@
      /* Clear the running thread indicator */
      VG_(running_tid) = VG_INVALID_THREADID;
      tl_assert(VG_(running_tid) == VG_INVALID_THREADID);
+
+     /* Darwin only: tell the tools where the client's kernel commpage
+        is.  It would be better to do this by telling aspacemgr about
+        it -- see the now disused record_system_memory() in
+        initimg-darwin.c -- but that causes the sync checker to fail,
+        since the mapping doesn't appear in the kernel-supplied
+        process map.  So do it here instead. */
+#    if defined(VGP_amd64_darwin)
+     VG_TRACK( new_mem_startup,
+               0x7fffffe00000, 0x7ffffffff000-0x7fffffe00000,
+               True, False, True, /* r-x */
+               0 /* di_handle: no associated debug info */ );
+#    elif defined(VGP_x86_darwin)
+     VG_TRACK( new_mem_startup,
+               0xfffec000, 0xfffff000-0xfffec000,
+               True, False, True, /* r-x */
+               0 /* di_handle: no associated debug info */ );
+#    endif
    }
 
    //--------------------------------------------------------------