我正在使用以下设置运行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
最佳答案
这些是stdin
,stdout
和stderr
。通常,您可以忽略这些,但是如果您确实想提倡精挑细选,请执行以下操作: