|
From: Nicholas N. <nj...@ca...> - 2003-03-18 19:19:33
|
Hi,
I've just hacked up support for automatic suppression generation. If
everyone likes it, I will commit it to the HEAD.
Some notes:
- option name is --gen-suppressions=yes which is maybe too long...
maybe --gen-supps=yes would be better
- it required two new functions, SK_(get_error_name)() and
SK_(print_extra_suppression_info)(), which must be defined by skins
using the ``skin_errors'' need.
A skin can be lazy and not support automatic generation of
suppressions by returning NULL from SK_(get_error_name)().
Alternatively, it can choose to support it for only a subset
of all error kinds -- eg. Memcheck doesn't support suppression of
`User' errors.
- upon each error, the user is prompted if they want the suppression to
be generated, a la the GDB attachment prompting
- the generated suppressions look like this:
{
<insert a suppression name here>
Memcheck:Addr1
fun:ddd
fun:bbb
fun:aaa
}
I could change it so the title is eg. ddd/bbb/aaa, but I like the
"<insert suppression name here>" better, since it emphasises that the
user can choose the name. Also the code is easier :) Besides, I
think the ddd/bbb/aaa confuses users a lot already... outputting that
might make users think the name important (when it's really only used
with -v) or that it has to have the x/y/z structure, or something.
- I just print out the suppression to stderr. It could be done more
fancily, eg. by appending the suppressions to a specified file or
something, but I think cut+paste is good enough. In my testing, I
found it quite agreeable. But others may disagree.
- Getting it working with leak checking required a bit of ugly hackery,
but then, leak suppressions were already pretty ugly, since they
don't use the general error recording mechanisms. I had to add
a "LeakErr" error type. (The leak checker should really be in the
MemCheck skin, not in core...[sigh])
- I've tested it reasonably thoroughly with Memcheck and Addrcheck...
among other things, I was able to correctly suppress the 10 value/addr
errors and a whole bunch of leaks that my (pre KDE 3) version of
Konqueror was emitting, so it seems to be working fairly well.
- I've even updated the documentation, including fixing a few minor
bugs in other unrelated parts.
Note that the section on writing suppression files has disappeared in
the v1.9.X docs! This is bad.
Also, the guide to writing skins isn't included.
I think this patch is extremely useful, _especially_ since I just
discovered that C++ function names must be *mangled* to use in
suppressions! No wonder people were having difficulty writing their own
suppressions. The manual only mentioned this under the description of the
--demangle option, which was very easy to miss.
Comments welcome.
N
|