summaryrefslogtreecommitdiffstats
path: root/tools/format-suppressions.py
blob: cc9d2fbd11db5ba8f11bc8f44d0e3c821cb64473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import re

valgrind_log = open('log','r').read()

inblock = False
l = 0
i = 0
keep = dict()

limit_re = r'type'

for line in valgrind_log.splitlines():
    if line.startswith('{'):
        inblock = True
        block = []
        continue
    if line.startswith('}'):
        inblock = False
        l = 0
        i += 1
        ok = False
        name = ""
        for x in block[2:]:
            name = name + x
            if re.search(limit_re, x):
                ok = True
                break
        if ok:
            keep[name] = block
        continue
    if inblock:
        block.append(line)
i = 43
for x in keep:
    block = keep[x]
    print "{"
    print "   suppression", i
    for x in block[1:]:
        print x
        if re.search(limit_re, x):
            break
    print '}'
    i += 1