在Mac 10.6上以32位模式运行valgrind?
如果我在Mac 10.6编译一个32位可执行文件,与-m32标志,如:在Mac 10.6上以32位模式运行valgrind?
的gcc -m32 test.c的-o测试
在 “测试” 运行Valgrind的失败,出现错误:
的valgrind:./test:不能执行二进制文件
是否有任何标志传递给Valgrind的执行呢?是在32位模式下编译valgrind的唯一选择吗?
由于
搅拌机,所述-m32标志只是意味着编译在32位模式下的文件。 Mac 10.6可以运行32位可执行文件。
请使用评论回答其他评论。答案是*真实的*你的问题的答案。 – 2011-05-22 21:44:49
是的,但是评论按钮在Blender的评论或您的第一条评论下是不可见的。不过,这是在这个评论之下。错误? – silmaersti 2011-05-23 02:29:32
Valgrind的哪个版本有问题?
在Linux和MacOS上,Valgrind的一个版本可以自动检测并为32位和64位二进制文件做正确的事情。
这是我看到Mac OS X 10.6.7 (10J869)
:
$ echo "int main() { free(1); return 0; }" | gcc -xc - -g -o a.out
$ echo "int main() { free(1); return 0; }" | gcc -xc - -g -o a.out32 -m32
$ valgrind --version
valgrind-3.7.0.SVN
$ valgrind ./a.out
==46102== Memcheck, a memory error detector
==46102== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==46102== Using Valgrind-3.7.0.SVN and LibVEX; rerun with -h for copyright info
==46102== Command: ./a.out
==46102==
--46102-- ./a.out:
--46102-- dSYM directory is missing; consider using --dsymutil=yes
==46102== Invalid free()/delete/delete[]/realloc()
==46102== at 0x100010E9F: free (vg_replace_malloc.c:366)
==46102== by 0x100000F26: main (in ./a.out)
==46102== Address 0x1 is not stack'd, malloc'd or (recently) free'd
==46102==
==46102==
==46102== HEAP SUMMARY:
==46102== in use at exit: 88 bytes in 1 blocks
==46102== total heap usage: 1 allocs, 1 frees, 88 bytes allocated
==46102==
==46102== LEAK SUMMARY:
==46102== definitely lost: 0 bytes in 0 blocks
==46102== indirectly lost: 0 bytes in 0 blocks
==46102== possibly lost: 0 bytes in 0 blocks
==46102== still reachable: 0 bytes in 0 blocks
==46102== suppressed: 88 bytes in 1 blocks
==46102==
==46102== For counts of detected and suppressed errors, rerun with: -v
==46102== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
$ valgrind ./a.out32
==46103== Memcheck, a memory error detector
==46103== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==46103== Using Valgrind-3.7.0.SVN and LibVEX; rerun with -h for copyright info
==46103== Command: ./a.out32
==46103==
--46103-- ./a.out32:
--46103-- dSYM directory is missing; consider using --dsymutil=yes
==46103== Invalid free()/delete/delete[]/realloc()
==46103== at 0xF7D8: free (vg_replace_malloc.c:366)
==46103== by 0x1F7B: main (in ./a.out32)
==46103== Address 0x1 is not stack'd, malloc'd or (recently) free'd
==46103==
==46103==
==46103== HEAP SUMMARY:
==46103== in use at exit: 320 bytes in 7 blocks
==46103== total heap usage: 7 allocs, 1 frees, 320 bytes allocated
==46103==
==46103== LEAK SUMMARY:
==46103== definitely lost: 0 bytes in 0 blocks
==46103== indirectly lost: 0 bytes in 0 blocks
==46103== possibly lost: 0 bytes in 0 blocks
==46103== still reachable: 260 bytes in 6 blocks
==46103== suppressed: 60 bytes in 1 blocks
==46103== Rerun with --leak-check=full to see details of leaked memory
==46103==
==46103== For counts of detected and suppressed errors, rerun with: -v
==46103== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
我有这个问题太,配合内置的valgrind /通过MacPorts的安装。然而,当我自己建造它时,问题就消失了。我可以确认在没有额外配置选项的情况下valgrind的默认版本支持Snow Leopard上的32位和64位程序(使用版本3.6.1)。
尝试完全删除'-m32'标志。该错误意味着二进制文件不适合您的体系结构(64位)。 – Blender 2011-05-21 15:53:19