valgrind` --track-fds = yes`没有fds 0,1,2

时间:2012-11-07 22:59:48

标签: valgrind

我正在使用以下设置运行valgrind: valgrind --tool=memcheck --tool=callgrind --num-callers=20 --track-fds=yes --error-exitcode=1 CMD。特别是,--track-fds=yes可以根据需要工作,但每次运行都会因fds 0,1,2而失败,因为它们应该打开。但是,我不想放弃--track-fds,因为它肯定会提供有意义的信息。那么,是否有一个valgrind选项/方法来跟踪除0,1,2之外的fds?

==5872== FILE DESCRIPTORS: 3 open at exit.
==5872== Open file descriptor 2:
==5872==    <inherited from parent>
==5872== 
==5872== Open file descriptor 1:
==5872==    <inherited from parent>
==5872== 
==5872== Open file descriptor 0: /dev/pts/0
==5872==    <inherited from parent>
==5872== 
==5872== 
==5872== Events    : Ir
==5872== Collected : 3081079256
==5872== 
==5872== I   refs:      3,081,079,256

1 个答案:

答案 0 :(得分:11)

这些是stdinstdoutstderr。通常你可以忽略这些,但如果你真的想要挑剔:

  

fclose(stdin);
  fclose(stdout);
  fclose(stderr);