18 '--trace-children=yes',
19 '--ignore-ranges=0x000-0xFFF',
24command = VALGRIND_ARGUMENTS + sys.argv[1:]
27process = subprocess.Popen(
28 command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
30output = process.stdout.readlines()
31errors = process.stderr.readlines()
35if len(output) > 0
and output[0].startswith(
"** VALGRIND_ROOT="):
37sys.stdout.writelines(output)
41 sys.stderr.writelines(errors)
47LEAK_RE =
r"(?:definitely|indirectly) lost:"
48LEAK_LINE_MATCHER = re.compile(LEAK_RE)
49LEAK_OKAY_MATCHER = re.compile(
r"lost: 0 bytes in 0 blocks")
52 if LEAK_LINE_MATCHER.search(line):
54 if not LEAK_OKAY_MATCHER.search(line):
55 sys.stderr.writelines(errors)
59if not len(leaks)
in [0, 2, 3]:
60 sys.stderr.writelines(errors)
61 sys.stderr.write(
'\n\n#### Malformed Valgrind output.\n#### Exiting.\n')