valgrind不在OS X 10.8上工作

时间:2013-01-01 19:19:16

标签: valgrind osx-mountain-lion

每当我尝试在OS X 10.8笔记本上运行valgrind时,我得到:

bad executable (no stack)
valgrind: ./a.out: cannot execute binary file

有什么问题?我怎样才能解决这个问题?在Linux上一切正常,所以我不是在某种程度上滥用valgrind。我正在使用的确切行是valgrind --tool=memcheck --leak-check=full ./a.out

2 个答案:

答案 0 :(得分:8)

我收到同样的错误,但我刚刚使用HomeBrew将valgrind升级到3.8.1brew upgrade valgrind),虽然运行Valgrind会打印以下警告,但它仍然有效:

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.

答案 1 :(得分:3)

我使用valgrind和macports遇到了这个问题。事实证明我需要安装

sudo port install valgrind +universal

我试图对32位可执行文件进行valgrind,我相信没有+通用,32位支持不会被编译。