Every time I try to run valgrind
on my OS X 10.8 notebook, I get:
bad executable (no stack)
valgrind: ./a.out: cannot execute binary file
What is the problem? How can I fix this? Everything works fine on Linux, so it's not that I'm somehow misusing valgrind
. The exact line I'm using is valgrind --tool=memcheck --leak-check=full ./a.out
.
I was getting the same error, but I just upgraded valgrind to 3.8.1
(brew upgrade valgrind
using HomeBrew for me), and it works, although running Valgrind prints the following warning:
WARNING: Support on MacOS 10.8 is experimental and mostly broken.
WARNING: Expect incorrect results, assertions and crashes.
WARNING: In particular, Memcheck on 32-bit programs will fail to
WARNING: detect any errors associated with heap-allocated data.
I had this problem using valgrind with macports. It turns out I needed to install with
sudo port install valgrind +universal
I was trying to valgrind a 32bit executable and I believe that without +universal, 32bit support was not being compiled in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With