]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Just whitespace and comment changes.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 1 Jul 2009 02:39:26 +0000 (02:39 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 1 Jul 2009 02:39:26 +0000 (02:39 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10388

coregrind/launcher-darwin.c
coregrind/m_main.c

index 3c81feea2603fb916708b4d0fc8a1e987c9add68..d68cd57b236c99717ba478314152beaced79c90b 100644 (file)
@@ -50,8 +50,7 @@
 #include <mach-o/loader.h>
 
 #include "pub_core_debuglog.h"
-#include "pub_core_vki.h"       // Avoids warnings from
-                                // pub_core_libcfile.h
+#include "pub_core_vki.h"       // Avoids warnings from pub_core_libcfile.h
 #include "pub_core_libcproc.h"  // For VALGRIND_LIB, VALGRIND_LAUNCHER
 #include "pub_core_ume.h"
 
@@ -60,11 +59,11 @@ static struct {
    const char *apple_name;     // e.g. x86_64
    const char *valgrind_name;  // e.g. amd64
 } valid_archs[] = {
-   { CPU_TYPE_X86, "i386", "x86" }, 
-   { CPU_TYPE_X86_64, "x86_64", "amd64" }, 
-   { CPU_TYPE_ARM, "arm", "arm" }, 
-   { CPU_TYPE_POWERPC, "ppc", "ppc32" }, 
-   { CPU_TYPE_POWERPC64, "ppc64", "ppc64" }, 
+   { CPU_TYPE_X86,       "i386",   "x86" }, 
+   { CPU_TYPE_X86_64,    "x86_64", "amd64" }, 
+   { CPU_TYPE_ARM,       "arm",    "arm" }, 
+   { CPU_TYPE_POWERPC,   "ppc",    "ppc32" }, 
+   { CPU_TYPE_POWERPC64, "ppc64",  "ppc64" }, 
 };
 static int valid_archs_count = sizeof(valid_archs)/sizeof(valid_archs[0]);
 
@@ -139,7 +138,9 @@ static int fat_has_cputype(struct fat_header *fh, cpu_type_t cputype)
 }
 
 /* Examine the client and work out which arch it is for */
-static const char *select_arch(const char *clientname, cpu_type_t default_cputype, const char *default_arch)
+static const char *select_arch(
+      const char *clientname, cpu_type_t default_cputype,
+      const char *default_arch)
 {
    uint8_t buf[4096];
    ssize_t bytes;
index f3dfbcd570dc25cdb9fa25a799329f9bfd22edf2..e0544d36097f68a25a0493d722ccb8f3f116b4f9 100644 (file)
@@ -1253,6 +1253,29 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp )
    // (oversized pagezero or stack)
    //   p: none
    //--------------------------------------------------------------
+   // DDD:  comments from Greg Parker why these address-space-filling segments
+   // are necessary:
+   //
+   //   The memory maps are there to make sure that Valgrind's copies of libc
+   //   and dyld load in a non-default location, so that the inferior's own
+   //   libc and dyld do load in the default locations. (The kernel performs
+   //   the work of loading several things as described by the executable's
+   //   load commands, including the executable itself, dyld, the main
+   //   thread's stack, and the page-zero segment.) There might be a way to
+   //   fine-tune it so the maps are smaller but still do the job.
+   //
+   //   The post-launch mmap behavior can be cleaned up - looks like we don't
+   //   unmap as much as we should - which would improve post-launch
+   //   performance.
+   //
+   //   Hmm, there might be an extra-clever way to give Valgrind a custom
+   //   MH_DYLINKER that performs the "bootloader" work of loading dyld in an
+   //   acceptable place and then unloading itself. Then no mmaps would be
+   //   needed. I'll have to think about that one.
+   //
+   // [I can't work out where the address-space-filling segments are
+   // created in the first place. --njn]
+   //
 #if defined(VGO_darwin)
 # if VG_WORDSIZE == 4
    VG_(do_syscall2)(__NR_munmap, 0x00000000, 0xf0000000);