I installed valgrind on Snow Leopard using the patch at 开发者_如何学Pythonhttps://bugs.kde.org/show_bug.cgi?id=205241 . However, when I run it with a binary I compiled from C++ code, I'm told that valgrind "cannot execute binary file". What g++ flags should I set to make my program work with valgrind?
Be sure to use the -m32 option to generate a 32-bit executable. The compiler default is 64-bit (assuming you have a 64-bit machine), but valgrind does not yet officially support 64-bit executables on Mac OS X. The file
command on your executable should report "Mach-O executable i386".
精彩评论