如何让valgrind忽略某些行? [英] How to make valgrind ignore certain line?
问题描述
例如
==26460== 2 bytes in 1 blocks are still reachable in loss record 2 of 105
==26460== at 0x4C28BE3: malloc (vg_replace_malloc.c:299)
==26460== by 0x580D889: strdup (in /usr/lib64/libc-2.17.so)
==26460== by 0x4F50AF: init (init.c:468)
==26460== by 0x406D75: main (main.c:825)
我不想检查 init.c:468: mode = strdup
,我确定这只会 malloc 一次,并且会持续整个进程生命.
I want to not check init.c:468: mode = strdup
, i'm sure this only malloc once, and will last whole process life.
是否可以让 valgrind 不检查这一行?
Is it possible to make valgrind not check this line?
推荐答案
正如我在评论中所说:我建议不要这样做.
As I said in my comment: I recommend not to.
但是 Valgrind 确实具有抑制警告的功能.专用于该目的的功能支持抑制特定消息的最便捷方式:
But Valgrind does have a feature to suppress warnings. The most convenient way of suppressing a specific message is supported by the feature dedicated to exactly that purpose:
--gen-suppressions=yes
这显然会为每个/任何生成的消息输出精确的抑制语法.
Which apparently will ouptput the precise suppression syntax for each/any generated message.
请参阅常见问题中的 5.1:
http://valgrind.org/docs/manual/faq.html#faq.写补充
See 5.1 in the FAQ:
http://valgrind.org/docs/manual/faq.html#faq.writesupp
(我喜欢他们的风格:
F:你能写……给我吗?"我期望一个完全足够的
答:没有."但他们实际上回答了
答:是的……".超酷.)
这篇关于如何让valgrind忽略某些行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!