Search code examples
valgrind

Valgrind and wildcard?


According to the valgrind docs:

Locations may be names of either shared objects, functions, or source lines. They begin with obj:, fun:, or src: respectively. Function, object, and file names to match against may use the wildcard characters * and ?. Source lines are specified using the form filename[:lineNumber].

So ? counts as a wildcard, but, to match what? I have stackframes like:

==60548== Invalid write of size 4
==60548==    by 0x....: ???
==60548==    by 0x....: ???
==60548==    by 0x....: function_signature_2 (in /some/path/libX.so)
==60548==    by 0x....: function_signature_3 (in /some/path/libX.so)
==60548==    by 0x....: function_signature_4 (some_file2:some_line2)

and I want to filter those that have ??? in the top of the stack for example. I can write the custom suppression:

{
   mysuppression
   Memcheck:Addr4
   obj:???
}

and it seems to work nicely, but what exactly does ?? Matching one single character (and so obj:??? is matching all objects whose name is 3 chars long?), or marking the previous character as optionally appearing? (in which case, what would ? as first character mean?), or any other similar meaning?


Solution

  • The matching is like shell globbing.

    * matches any number of any character. ? matches once any character.

    In the log file, ??? means that no function name was found. It doesn’t have any meaning in terms of matching like the suppression syntax.