Valgrind support for MacOS X 10.10 (Yosemite)

Valgrind support on Yosemite has improved significantly in the past few months. It is now feasible to run Firefox on Valgrind on Yosemite. Support for 10.9 (Mavericks) has also improved, but 64-bit Yosemite remains the primary focus of support work.

For various reasons, MacOS is a difficult target for Valgrind. So you’ll find it little slower, and possibly more flaky, than running on Linux. Occasionally, the MacOS kernel will panic, for unknown reasons.  But it does work.

Full details of running Firefox on Valgrind on Yosemite are at https://developer.mozilla.org/en-US/docs/Mozilla/Testing/Valgrind.  For serious use, you need to read that page.  In the meantime, here is the minimal getting-started recipe.

First, build Valgrind. You’ll need to use the trunk, since Yosemite support didn’t make it in time for the current stable (3.10.x) line.

  svn co svn://svn.valgrind.org/valgrind/trunk valgrind-trunk
  cd valgrind-trunk
  ./autogen.sh && ./configure --prefix=`pwd`/Inst
  make -j8 && make -j8 install

Make the headers available for building Firefox:

  cd /usr/include
  sudo ln -s /path/to/valgrind-trunk/Inst/include/valgrind .

Now build your Firefox tree. I recommend a mozconfig containing
these:

  ac_add_options --disable-debug
  ac_add_options --enable-optimize="-g -O2"
  ac_add_options --disable-jemalloc
  ac_add_options --enable-valgrind

And run, being sure to run the real binary (firefox-bin):

  /path/to/valgrind-trunk/Inst/bin/valgrind --smc-check=all-non-file \
   --vex-iropt-register-updates=allregs-at-mem-access --dsymutil=yes \
   ./objdir/dist/Nightly.app/Contents/MacOS/firefox-bin