我如何发现 Valgrind 中被抑制的错误?
我有以下 valgrind 输出:
==28099==
==28099== HEAP SUMMARY:
==28099== in use at exit: 0 bytes in 0 blocks
==28099== total heap usage: 131 allocs, 131 frees, 3,472 bytes allocated
==28099==
==28099== All heap blocks were freed -- no leaks are possible
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
--28099--
--28099-- used_suppression: 2 dl-hack3-cond-1
--28099-- used_suppression: 2 glibc-2.5.x-on-SUSE-10.2-(PPC)-2a
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
有 4 个被抑制的错误。虽然这里没有泄漏,但是在移植到另一个系统时会产生问题。
[编辑]
我也使用 valgrind -v
选项重新运行。但我没有发现任何错误。
<代码>
==30287== Memcheck, a memory error detector
==30287== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==30287== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==30287== Command: ./EXECUTABLE1 test_input.txt
==30287==
--30287-- Valgrind options:
--30287-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--30287-- -v
--30287-- --gen-suppressions=all
--30287-- --error-limit=no
--30287-- Contents of /proc/version:
--30287-- Linux version 2.6.38.3.2.amd64-smp (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Wed Apr 20 17:36:19 CEST 2011
--30287-- Arch and hwcaps: AMD64, amd64-sse3-cx16
--30287-- Page sizes: currently 4096, max supported 4096
--30287-- Valgrind library directory: /usr/lib/valgrind
--30287-- Reading syms from /home/path/to/file(0x400000)
--30287-- Reading syms from /lib/ld-2.11.2.so (0x4000000)
--30287-- Considering /lib/ld-2.11.2.so ..
--30287-- .. CRC mismatch (computed cd91cee9 wanted 11b4673c)
--30287-- Considering /usr/lib/debug/lib/ld-2.11.2.so ..
--30287-- .. CRC is valid
--30287-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux (0x38000000)
--30287-- object doesn't have a dynamic symbol table
--30287-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
--30287-- Reading suppressions file: /usr/lib/valgrind/default.supp
--30287-- REDIR: 0x4016230 (strlen) redirected to 0x380408a7 (vgPlain_amd64_linux_REDIR_FOR_strlen)
--30287-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so (0x4a20000)
--30287-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so (0x4c21000)
==30287== WARNING: new redirection conflicts with existing -- ignoring it
--30287-- new: 0x04016230 (strlen ) R-> 0x04c25850 strlen
--30287-- REDIR: 0x40160a0 (index) redirected to 0x4c25460 (index)
--30287-- REDIR: 0x4016120 (strcmp) redirected to 0x4c25e30 (strcmp)
--30287-- Reading syms from /lib/libm-2.11.2.so (0x4e29000)
--30287-- Considering /lib/libm-2.11.2.so ..
--30287-- .. CRC mismatch (computed dd5c85df wanted ccd85fcf)
--30287-- Considering /usr/lib/debug/lib/libm-2.11.2.so ..
--30287-- .. CRC is valid
--30287-- Reading syms from /lib/libc-2.11.2.so (0x50ab000)
--30287-- Considering /lib/libc-2.11.2.so ..
--30287-- .. CRC mismatch (computed 7d8e8f4f wanted 9b015f2c)
--30287-- Considering /usr/lib/debug/lib/libc-2.11.2.so ..
--30287-- .. CRC is valid
--30287-- REDIR: 0x5128600 (__GI_strrchr) redirected to 0x4c25280 (__GI_strrchr)
--30287-- REDIR: 0x51218c0 (malloc) redirected to 0x4c24466 (malloc)
--30287-- REDIR: 0x5128d00 (memchr) redirected to 0x4c25ed0 (memchr)
--30287-- REDIR: 0x512a750 (memcpy) redirected to 0x4c25f00 (memcpy)
--30287-- REDIR: 0x5126b10 (strlen) redirected to 0x4a205ac (_vgnU_ifunc_wrapper)
==30287== WARNING: new redirection conflicts with existing -- ignoring it
--30287-- new: 0x05126b40 (__GI_strlen ) R-> 0x04c257f0 strlen
--30287-- REDIR: 0x5126b40 (__GI_strlen) redirected to 0x4c25810 (__GI_strlen)
--30287-- REDIR: 0x512baf0 (__GI___rawmemchr) redirected to 0x4c26ba0 (__GI___rawmemchr)
--30287-- REDIR: 0x51217e0 (free) redirected to 0x4c24076 (free)
Following are the keys and their corresponding value present
--30287-- REDIR: 0x512bb40 (strchrnul) redirected to 0x4c26b50 (strchrnul)
I have following valgrind output:
==28099==
==28099== HEAP SUMMARY:
==28099== in use at exit: 0 bytes in 0 blocks
==28099== total heap usage: 131 allocs, 131 frees, 3,472 bytes allocated
==28099==
==28099== All heap blocks were freed -- no leaks are possible
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
--28099--
--28099-- used_suppression: 2 dl-hack3-cond-1
--28099-- used_suppression: 2 glibc-2.5.x-on-SUSE-10.2-(PPC)-2a
==28099==
==28099== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
There are 4 suppressed error. Although there is no leak here, but creats problem while porting to another system.
[EDIT]
I rerun with the valgrind -v
option too. But I don't find any errors there.
==30287== Memcheck, a memory error detector ==30287== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==30287== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==30287== Command: ./EXECUTABLE1 test_input.txt ==30287== --30287-- Valgrind options: --30287-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp --30287-- -v --30287-- --gen-suppressions=all --30287-- --error-limit=no --30287-- Contents of /proc/version: --30287-- Linux version 2.6.38.3.2.amd64-smp (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Wed Apr 20 17:36:19 CEST 2011 --30287-- Arch and hwcaps: AMD64, amd64-sse3-cx16 --30287-- Page sizes: currently 4096, max supported 4096 --30287-- Valgrind library directory: /usr/lib/valgrind --30287-- Reading syms from /home/path/to/file(0x400000) --30287-- Reading syms from /lib/ld-2.11.2.so (0x4000000) --30287-- Considering /lib/ld-2.11.2.so .. --30287-- .. CRC mismatch (computed cd91cee9 wanted 11b4673c) --30287-- Considering /usr/lib/debug/lib/ld-2.11.2.so .. --30287-- .. CRC is valid --30287-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux (0x38000000) --30287-- object doesn't have a dynamic symbol table --30287-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp --30287-- Reading suppressions file: /usr/lib/valgrind/default.supp --30287-- REDIR: 0x4016230 (strlen) redirected to 0x380408a7 (vgPlain_amd64_linux_REDIR_FOR_strlen) --30287-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so (0x4a20000) --30287-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so (0x4c21000) ==30287== WARNING: new redirection conflicts with existing -- ignoring it --30287-- new: 0x04016230 (strlen ) R-> 0x04c25850 strlen --30287-- REDIR: 0x40160a0 (index) redirected to 0x4c25460 (index) --30287-- REDIR: 0x4016120 (strcmp) redirected to 0x4c25e30 (strcmp) --30287-- Reading syms from /lib/libm-2.11.2.so (0x4e29000) --30287-- Considering /lib/libm-2.11.2.so .. --30287-- .. CRC mismatch (computed dd5c85df wanted ccd85fcf) --30287-- Considering /usr/lib/debug/lib/libm-2.11.2.so .. --30287-- .. CRC is valid --30287-- Reading syms from /lib/libc-2.11.2.so (0x50ab000) --30287-- Considering /lib/libc-2.11.2.so .. --30287-- .. CRC mismatch (computed 7d8e8f4f wanted 9b015f2c) --30287-- Considering /usr/lib/debug/lib/libc-2.11.2.so .. --30287-- .. CRC is valid --30287-- REDIR: 0x5128600 (__GI_strrchr) redirected to 0x4c25280 (__GI_strrchr) --30287-- REDIR: 0x51218c0 (malloc) redirected to 0x4c24466 (malloc) --30287-- REDIR: 0x5128d00 (memchr) redirected to 0x4c25ed0 (memchr) --30287-- REDIR: 0x512a750 (memcpy) redirected to 0x4c25f00 (memcpy) --30287-- REDIR: 0x5126b10 (strlen) redirected to 0x4a205ac (_vgnU_ifunc_wrapper) ==30287== WARNING: new redirection conflicts with existing -- ignoring it --30287-- new: 0x05126b40 (__GI_strlen ) R-> 0x04c257f0 strlen --30287-- REDIR: 0x5126b40 (__GI_strlen) redirected to 0x4c25810 (__GI_strlen) --30287-- REDIR: 0x512baf0 (__GI___rawmemchr) redirected to 0x4c26ba0 (__GI___rawmemchr) --30287-- REDIR: 0x51217e0 (free) redirected to 0x4c24076 (free) Following are the keys and their corresponding value present --30287-- REDIR: 0x512bb40 (strchrnul) redirected to 0x4c26b50 (strchrnul)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在
/usr/lib/valgrind/default.supp
中查看/修改已抑制的错误。You can view / modify the suppressed errors in
/usr/lib/valgrind/default.supp
.被抑制的错误只是系统特定的错误,以及您的库的已知问题。因此,它们并不是另一个系统的可移植性问题的正确嫌疑人。
The suppressed errors are just errors that are system specific, known problems with your libraries. So they are not the right suspects for portability problems to another system.
在 x86 主机上 valgrind 输出这样的行:
有关检测到和抑制的错误的计数,请使用 -v 重新运行
因此,像这样运行你的程序:
valgrind -v ./myprog
。On x86 hosts valgrind outputs such line:
For counts of detected and suppressed errors, rerun with: -v
So run your prog like this:
valgrind -v ./myprog
.