srz2
srz2

Reputation: 162

Unable to suppress errors in valgrind

Can someone please show me an example of how to add custom suppressions to valgrind? I am 99.99% sure it generates an error for the string class and I want to suppress the errors in a .supp file. I thought it would be simple enough just adding it to the directory or just adding my function to the default.supp but the error is not suppress. This is what I did:

1) I Ran valgrind with --gen-suppressions=yes 2) Obtained the generated suppression for my error listed below

  #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) I added the file to the directory where default.supp is located which is in my eclipse folder

4) I ran valgrind again but the error is still there

Note: I also tried adding the suppression to the default.supp file. Am I missing a step? What am I doing wrong?

Upvotes: 2

Views: 4483

Answers (1)

mjs
mjs

Reputation: 3005

I am pretty sure you need to specify the suppression file when you run valgrind, like this

##Generate suppressions
valgrind --gen-suppressions=yes myProgram
## Cut-Paste into string.supp
##Now rerun valgrind
valgrind --suppressions=./string.supp myProgram

See command line options for more detail.

Upvotes: 3

Related Questions