有谁能给我举个例子,说明如何在“英勇”中添加定制的抑制措施?我99.99%确信它会为string类生成一个错误,并且我希望抑制.supp文件中的错误。我认为只要将其添加到目录或将我的函数添加到default.supp中就足够简单了,但是错误并没有被抑制。我就是这样做的:
( 1)我使用--gen-suppressions=yes 2运行val差使,获得了对下面列出的错误产生的抑制
#Custom Suppression
{
MyCustomSupression
Memcheck:Addr1
fun:strlen
fun:_ZNSsC1EPKcRKSaIcE
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
obj:/home/steve/path/to/the/program
fun:(below main)}
3)我将文件添加到default.supp所在的目录中,该目录位于eclipse文件夹中。
4)我又跑了一遍,但错误仍然存在。
注意:我还尝试将抑制添加到default.supp文件。我是不是错过了一步?我做错了什么?
发布于 2015-02-13 22:09:31
我很确定您在运行val差制时需要指定抑制文件,如下所示
##Generate suppressions
valgrind --gen-suppressions=yes myProgram
## Cut-Paste into string.supp
##Now rerun valgrind
valgrind --suppressions=./string.supp myProgram有关更多细节,请参见命令行选项。
https://stackoverflow.com/questions/28509491
复制相似问题