Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 瓦尔格兰德';噪音';,这是什么意思?_C_Linux_Gcc_Valgrind - Fatal编程技术网

C 瓦尔格兰德';噪音';,这是什么意思?

C 瓦尔格兰德';噪音';,这是什么意思?,c,linux,gcc,valgrind,C,Linux,Gcc,Valgrind,当我使用valgrind帮助调试我正在开发的一个应用程序时,我注意到大量的噪音似乎在抱怨标准库。作为测试,我做了这个 echo 'int main() {return 0;}' | gcc -x c -o test - valgrind ./test ==1096== Use of uninitialised value of size 8 ==1096== at 0x400A202: _dl_new_object (in /lib64/ld-2.10.1.so) ==1096==

当我使用valgrind帮助调试我正在开发的一个应用程序时,我注意到大量的噪音似乎在抱怨标准库。作为测试,我做了这个

echo 'int main() {return 0;}' | gcc -x c -o test -
valgrind ./test

==1096== Use of uninitialised value of size 8
==1096==    at 0x400A202: _dl_new_object (in /lib64/ld-2.10.1.so)
==1096==    by 0x400607F: _dl_map_object_from_fd (in /lib64/ld-2.10.1.so)
==1096==    by 0x4007A2C: _dl_map_object (in /lib64/ld-2.10.1.so)
==1096==    by 0x400199A: map_doit (in /lib64/ld-2.10.1.so)
==1096==    by 0x400D495: _dl_catch_error (in /lib64/ld-2.10.1.so)
==1096==    by 0x400189E: do_preload (in /lib64/ld-2.10.1.so)
==1096==    by 0x4003CCD: dl_main (in /lib64/ld-2.10.1.so)
==1096==    by 0x401404B: _dl_sysdep_start (in /lib64/ld-2.10.1.so)
==1096==    by 0x4001471: _dl_start (in /lib64/ld-2.10.1.so)
==1096==    by 0x4000BA7: (within /lib64/ld-2.10.1.so)
* large block of similar snipped *
==1096== Use of uninitialised value of size 8
==1096==    at 0x4F35FDD: (within /lib64/libc-2.10.1.so)
==1096==    by 0x4F35B11: (within /lib64/libc-2.10.1.so)
==1096==    by 0x4A1E61C: _vgnU_freeres (vg_preloaded.c:60)
==1096==    by 0x4E5F2E4: __run_exit_handlers (in /lib64/libc-2.10.1.so)
==1096==    by 0x4E5F354: exit (in /lib64/libc-2.10.1.so)
==1096==    by 0x4E48A2C: (below main) (in /lib64/libc-2.10.1.so)
==1096==
==1096== ERROR SUMMARY: 3819 errors from 298 contexts (suppressed: 876 from 4)
==1096== malloc/free: in use at exit: 0 bytes in 0 blocks.
==1096== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==1096== For counts of detected errors, rerun with: -v
==1096== Use --track-origins=yes to see where uninitialised values come from
==1096== All heap blocks were freed -- no leaks are possible.
然后我就这样做了,

echo 'int main() {return 0;}' | gcc -x c -o test -
valgrind ./test

==1096== Use of uninitialised value of size 8
==1096==    at 0x400A202: _dl_new_object (in /lib64/ld-2.10.1.so)
==1096==    by 0x400607F: _dl_map_object_from_fd (in /lib64/ld-2.10.1.so)
==1096==    by 0x4007A2C: _dl_map_object (in /lib64/ld-2.10.1.so)
==1096==    by 0x400199A: map_doit (in /lib64/ld-2.10.1.so)
==1096==    by 0x400D495: _dl_catch_error (in /lib64/ld-2.10.1.so)
==1096==    by 0x400189E: do_preload (in /lib64/ld-2.10.1.so)
==1096==    by 0x4003CCD: dl_main (in /lib64/ld-2.10.1.so)
==1096==    by 0x401404B: _dl_sysdep_start (in /lib64/ld-2.10.1.so)
==1096==    by 0x4001471: _dl_start (in /lib64/ld-2.10.1.so)
==1096==    by 0x4000BA7: (within /lib64/ld-2.10.1.so)
* large block of similar snipped *
==1096== Use of uninitialised value of size 8
==1096==    at 0x4F35FDD: (within /lib64/libc-2.10.1.so)
==1096==    by 0x4F35B11: (within /lib64/libc-2.10.1.so)
==1096==    by 0x4A1E61C: _vgnU_freeres (vg_preloaded.c:60)
==1096==    by 0x4E5F2E4: __run_exit_handlers (in /lib64/libc-2.10.1.so)
==1096==    by 0x4E5F354: exit (in /lib64/libc-2.10.1.so)
==1096==    by 0x4E48A2C: (below main) (in /lib64/libc-2.10.1.so)
==1096==
==1096== ERROR SUMMARY: 3819 errors from 298 contexts (suppressed: 876 from 4)
==1096== malloc/free: in use at exit: 0 bytes in 0 blocks.
==1096== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==1096== For counts of detected errors, rerun with: -v
==1096== Use --track-origins=yes to see where uninitialised values come from
==1096== All heap blocks were freed -- no leaks are possible.
您可以在此处看到完整的结果:

我有两个问题,;首先,有没有办法抑制所有的噪音


--默认情况下,show below main设置为no,但在main之后似乎没有--show等同物

您可以通过添加

{
   ld error suppression
   Memcheck:Cond
   fun:dl_main
   fun:_dl_sysdep_start
   fun:_dl_start
   obj:/lib64/ld-2.10.1.so
}
/usr/lib/valgrind/default.supp
(或定义自己的抑制文件)


至少对Debian&Arch Linux开发人员来说,这似乎是一个已知的链接器/加载程序错误;我不确定其余部分,以及他们计划的行动路线。

升级到Valgrind 3.5.0或更高版本。除其他事项外,默认的.supp文件已经更新。

我不时会出现这些症状,解决方案总是升级我的valgrind和libc软件包,使之同步。Debian的可爱的小精灵会照顾其他人。

这个问题是因为使用了比Valgrind熟悉的更新的glibc+谢谢你给我指出了正确的方向。