summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/suppressions.py
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 08:19:18 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 08:19:18 +0000
commite01e737e289dfb5a6a2ce04b73a2c932a72ee342 (patch)
tree3cb92e2e2023d05e5184d878d700ba57cf0a3806 /tools/valgrind/suppressions.py
parent50e9a23ce0f459dc34748a10a9a1a727602b2f5f (diff)
downloadchromium_src-e01e737e289dfb5a6a2ce04b73a2c932a72ee342.zip
chromium_src-e01e737e289dfb5a6a2ce04b73a2c932a72ee342.tar.gz
chromium_src-e01e737e289dfb5a6a2ce04b73a2c932a72ee342.tar.bz2
Replace all Memcheck:(Addr[1248]|Cond|Value[1248]) with Memcheck:Unaddressable and Memcheck:Uninitialized
TODO in follow-up CLs: remove duplicate stacks which had different types. The support for these new suppression types have been added to valgrind-variant in http://code.google.com/p/valgrind-variant/source/detail?r=116 It should decrease the pain of writing up to 5 different suppressions for one error giving reports at different instructions, e.g. memcpy(..., ..., 17) on a free'd buffer will likely give us all flavours of Addr* Also, there's an upstream feature request with positive feedback from the authors of Memcheck. BUG=https://bugs.kde.org/show_bug.cgi?id=256525#c6 Also, the suppression generator code has been changed to not produce suppressions of "legacy" types anymore and the tools/valgrind/waterfall.sh suppression matcher has been altered to support both "legacy" and "new" type suppressions. TEST=base --gtest_filter="*Sanity*" + tools/valgrind/suppressions.py SelfTest() Review URL: http://codereview.chromium.org/8712001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind/suppressions.py')
-rw-r--r--tools/valgrind/suppressions.py154
1 files changed, 141 insertions, 13 deletions
diff --git a/tools/valgrind/suppressions.py b/tools/valgrind/suppressions.py
index 8669a5e..90362bc 100644
--- a/tools/valgrind/suppressions.py
+++ b/tools/valgrind/suppressions.py
@@ -71,6 +71,36 @@ class Suppression(object):
re_line += '\n'
re_line += '(.*\n)*'
re_line += '}'
+
+ # In the recent version of valgrind-variant we've switched
+ # from memcheck's default Addr[1248]/Value[1248]/Cond suppression types
+ # to simply Unaddressable/Uninitialized.
+ # The suppression generator no longer gives us "old" types thus
+ # for the "new-type" suppressions:
+ # * Memcheck:Unaddressable should also match Addr* reports,
+ # * Memcheck:Uninitialized should also match Cond and Value reports,
+ #
+ # We also want to support legacy suppressions (e.g. copied from
+ # upstream bugs etc), so:
+ # * Memcheck:Addr[1248] suppressions should match Unaddressable reports,
+ # * Memcheck:Cond and Memcheck:Value[1248] should match Uninitialized.
+ # Please note the latest two rules only apply to the
+ # tools/valgrind/waterfall.sh suppression matcher and the real
+ # valgrind-variant Memcheck will not suppress
+ # e.g. Addr1 printed as Unaddressable with Addr4 suppression.
+ # Be careful to check the access size while copying legacy suppressions!
+ for sz in [1, 2, 4, 8]:
+ re_line = re_line.replace("\nMemcheck:Addr%d\n" % sz,
+ "\nMemcheck:(Addr%d|Unaddressable)\n" % sz)
+ re_line = re_line.replace("\nMemcheck:Value%d\n" % sz,
+ "\nMemcheck:(Value%d|Uninitialized)\n" % sz)
+ re_line = re_line.replace("\nMemcheck:Cond\n",
+ "\nMemcheck:(Cond|Uninitialized)\n")
+ re_line = re_line.replace("\nMemcheck:Unaddressable\n",
+ "\nMemcheck:(Addr.|Unaddressable)\n")
+ re_line = re_line.replace("\nMemcheck:Uninitialized\n",
+ "\nMemcheck:(Cond|Value.|Uninitialized)\n")
+
self._re = re.compile(re_line, re.MULTILINE)
def Match(self, suppression_from_report):
@@ -163,9 +193,10 @@ def ReadSuppressions(lines, supp_descriptor):
'is expected, got "%s"' % line)
supp_type = line.split(':')[1]
if not supp_type in ["Addr1", "Addr2", "Addr4", "Addr8",
- "Cond", "Free", "Jump", "Leak", "Overlap", "Param",
- "Value1", "Value2", "Value4", "Value8",
- "Race", "UnlockNonLocked", "InvalidLock"]:
+ "Cond", "Free", "Jump", "Leak", "Overlap", "Param",
+ "Value1", "Value2", "Value4", "Value8",
+ "Race", "UnlockNonLocked", "InvalidLock",
+ "Unaddressable", "Uninitialized"]:
raise SuppressionError(supp_descriptor, nline,
'Unknown suppression type "%s"' % supp_type)
cur_type = line
@@ -194,12 +225,12 @@ def TestStack(stack, positive, negative):
"Suppression:\n%s\ndidn't match stack:\n%s" % (supp, stack)
for supp in negative:
assert not ReadSuppressions(supp.split("\n"), "")[0].Match(stack), \
- "Suppression:\n%s\ndidn't match stack:\n%s" % (supp, stack)
+ "Suppression:\n%s\ndid match stack:\n%s" % (supp, stack)
def SelfTest():
"""Tests the Suppression.Match() capabilities."""
- test_stack1 = """{
+ test_memcheck_stack_1 = """{
test
Memcheck:Leak
fun:absolutly
@@ -209,7 +240,37 @@ def SelfTest():
fun:expression
}""".split("\n")
- test_stack2 = """{
+ test_memcheck_stack_2 = """{
+ test
+ Memcheck:Uninitialized
+ fun:absolutly
+ fun:brilliant
+ obj:condition
+ fun:detection
+ fun:expression
+ }""".split("\n")
+
+ test_memcheck_stack_3 = """{
+ test
+ Memcheck:Unaddressable
+ fun:absolutly
+ fun:brilliant
+ obj:condition
+ fun:detection
+ fun:expression
+ }""".split("\n")
+
+ test_memcheck_stack_4 = """{
+ test
+ Memcheck:Addr4
+ fun:absolutly
+ fun:brilliant
+ obj:condition
+ fun:detection
+ fun:expression
+ }""".split("\n")
+
+ test_heapcheck_stack = """{
test
Heapcheck:Leak
fun:absolutly
@@ -219,7 +280,7 @@ def SelfTest():
fun:expression
}""".split("\n")
- test_stack3 = """{
+ test_tsan_stack = """{
test
ThreadSanitizer:Race
fun:absolutly
@@ -230,7 +291,7 @@ def SelfTest():
}""".split("\n")
- positive_memcheck_suppressions = [
+ positive_memcheck_suppressions_1 = [
"{\nzzz\nMemcheck:Leak\nfun:absolutly\n}",
"{\nzzz\nMemcheck:Leak\nfun:ab*ly\n}",
"{\nzzz\nMemcheck:Leak\nfun:absolutly\nfun:brilliant\n}",
@@ -243,6 +304,33 @@ def SelfTest():
"{\nzzz\nMemcheck:Leak\n...\nfun:brilliant\nobj:condition\n}",
]
+ positive_memcheck_suppressions_2 = [
+ "{\nzzz\nMemcheck:Uninitialized\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Uninitialized\nfun:ab*ly\n}",
+ "{\nzzz\nMemcheck:Uninitialized\nfun:absolutly\nfun:brilliant\n}",
+ # Legacy suppression types
+ "{\nzzz\nMemcheck:Value1\n...\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Cond\n...\nfun:detection\n}",
+ "{\nzzz\nMemcheck:Value8\nfun:absolutly\nfun:brilliant\n}",
+ ]
+
+ positive_memcheck_suppressions_3 = [
+ "{\nzzz\nMemcheck:Unaddressable\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Unaddressable\nfun:absolutly\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Unaddressable\nfun:absolutly\nfun:brilliant\n}",
+ # Legacy suppression types
+ "{\nzzz\nMemcheck:Addr1\n...\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Addr8\n...\nfun:detection\n}",
+ ]
+
+ positive_memcheck_suppressions_4 = [
+ "{\nzzz\nMemcheck:Addr4\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Unaddressable\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Addr4\nfun:absolutly\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Unaddressable\n...\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Addr4\n...\nfun:detection\n}",
+ ]
+
positive_heapcheck_suppressions = [
"{\nzzz\nHeapcheck:Leak\n...\nobj:condition\n}",
"{\nzzz\nHeapcheck:Leak\nfun:absolutly\n}",
@@ -253,7 +341,7 @@ def SelfTest():
"{\nzzz\nThreadSanitizer:Race\nfun:absolutly\n}",
]
- negative_memcheck_suppressions = [
+ negative_memcheck_suppressions_1 = [
"{\nzzz\nMemcheck:Leak\nfun:abnormal\n}",
"{\nzzz\nMemcheck:Leak\nfun:ab*liant\n}",
"{\nzzz\nMemcheck:Leak\nfun:brilliant\n}",
@@ -261,6 +349,36 @@ def SelfTest():
"{\nzzz\nMemcheck:Addr8\nfun:brilliant\n}",
]
+ negative_memcheck_suppressions_2 = [
+ "{\nzzz\nMemcheck:Cond\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Value2\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Uninitialized\nfun:ab*liant\n}",
+ "{\nzzz\nMemcheck:Value4\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Leak\nobj:condition\n}",
+ "{\nzzz\nMemcheck:Addr8\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Unaddressable\nfun:brilliant\n}",
+ ]
+
+ negative_memcheck_suppressions_3 = [
+ "{\nzzz\nMemcheck:Addr1\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Uninitialized\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Addr2\nfun:ab*liant\n}",
+ "{\nzzz\nMemcheck:Value4\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Leak\nobj:condition\n}",
+ "{\nzzz\nMemcheck:Addr8\nfun:brilliant\n}",
+ ]
+
+ negative_memcheck_suppressions_4 = [
+ "{\nzzz\nMemcheck:Addr1\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Addr4\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Unaddressable\nfun:abnormal\n}",
+ "{\nzzz\nMemcheck:Addr1\nfun:absolutly\n}",
+ "{\nzzz\nMemcheck:Addr2\nfun:ab*liant\n}",
+ "{\nzzz\nMemcheck:Value4\nfun:brilliant\n}",
+ "{\nzzz\nMemcheck:Leak\nobj:condition\n}",
+ "{\nzzz\nMemcheck:Addr8\nfun:brilliant\n}",
+ ]
+
negative_heapcheck_suppressions = [
"{\nzzz\nMemcheck:Leak\nfun:absolutly\n}",
"{\nzzz\nHeapcheck:Leak\nfun:brilliant\n}",
@@ -271,11 +389,21 @@ def SelfTest():
"{\nzzz\nThreadSanitizer:Race\nfun:brilliant\n}",
]
- TestStack(test_stack1, positive_memcheck_suppressions,
- negative_memcheck_suppressions)
- TestStack(test_stack2, positive_heapcheck_suppressions,
+ TestStack(test_memcheck_stack_1,
+ positive_memcheck_suppressions_1,
+ negative_memcheck_suppressions_1)
+ TestStack(test_memcheck_stack_2,
+ positive_memcheck_suppressions_2,
+ negative_memcheck_suppressions_2)
+ TestStack(test_memcheck_stack_3,
+ positive_memcheck_suppressions_3,
+ negative_memcheck_suppressions_3)
+ TestStack(test_memcheck_stack_4,
+ positive_memcheck_suppressions_4,
+ negative_memcheck_suppressions_4)
+ TestStack(test_heapcheck_stack, positive_heapcheck_suppressions,
negative_heapcheck_suppressions)
- TestStack(test_stack3, positive_tsan_suppressions,
+ TestStack(test_tsan_stack, positive_tsan_suppressions,
negative_tsan_suppressions)
if __name__ == '__main__':