我如何发现 Valgrind 中被抑制的错误?

发布于 2024-12-07 02:16:12 字数 4197 浏览 1 评论 0原文

我有以下 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

瞎闹 2024-12-14 02:16:12

您可以在 /usr/lib/valgrind/default.supp 中查看/修改已抑制的错误。

You can view / modify the suppressed errors in /usr/lib/valgrind/default.supp.

一梦浮鱼 2024-12-14 02:16:12

被抑制的错误只是系统特定的错误,以及您的库的已知问题。因此,它们并不是另一个系统的可移植性问题的正确嫌疑人。

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.

乖乖兔^ω^ 2024-12-14 02:16:12

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文