1

我们在从 linux-2.6.3-long-term 编译的 Linux 虚拟机上运行我们的程序。我想valgrind在那台机器上运行,并以建议的方式从源代码编译。

./configure --prefix=/tmp/valgrind/
make
make install

然后,我把它复制/tmp/valgrind到我自己的Linux机器上,我把它放在目录/data下,设置环境变量:

export PATH=$PATH:/data/valgrind/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib64:/data/valgrind/lib
export VALGRIND_LIB=/data/valgrind/lib/valgrind

valgrind可以工作,并且可以检测除内存泄漏之外的其他一些错误。这是运行的结果valgrind ls -l

==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F3CDE: ??? (in /bin/busybox)
==2207==    by 0x80548ED: ??? (in /bin/busybox)
==2207==
==2207== Use of uninitialised value of size 4
==2207==    at 0x80D8F77: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F0F55: ??? (in /bin/busybox)
==2207==    by 0x80D8F49: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207== Conditional jump or move depends on uninitialised value(s)
==2207==    at 0x80F1000: ??? (in /bin/busybox)
==2207==    by 0x80D8F49: ??? (in /bin/busybox)
==2207==    by 0x8048866: ??? (in /bin/busybox)
==2207==
==2207==
==2207== HEAP SUMMARY:
==2207==     in use at exit: 0 bytes in 0 blocks
==2207==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2207==
==2207== All heap blocks were freed -- no leaks are possible
==2207==
==2207== For counts of detected and suppressed errors, rerun with: -v
==2207== Use --track-origins=yes to see where uninitialised values come from
==2207== ERROR SUMMARY: 2390 errors from 117 contexts (suppressed: 0 from 0)

总堆使用量为零。而且我发现有人已经遇到了同样的问题: 交叉编译的 Valgrind 没有检测到明显的泄漏 是已知问题吗?上面的链接没有告诉如何修复它,有人知道吗?

4

0 回答 0