From 58b2d85a21b60a6961ae83459a70e664080e4a54 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Mon, 16 Oct 2017 14:30:02 -0700 Subject: [PATCH] Checking in tools --- tools/debug/core/error_ref_leak.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/debug/core/error_ref_leak.py diff --git a/tools/debug/core/error_ref_leak.py b/tools/debug/core/error_ref_leak.py new file mode 100644 index 00000000000..99f986a97bc --- /dev/null +++ b/tools/debug/core/error_ref_leak.py @@ -0,0 +1,27 @@ +#!/bin/python + +import sys +import re + +data = sys.stdin.readlines() + +errs = [] +for line in data: + if re.search(r'error.cc', line): + line = line.partition('error.cc:')[-1] + line = re.sub(r'\d+] ', r'', line) + line = line.strip().split() + err = line[0].strip(":") + if line[1] == "create": + assert(err not in errs) + errs.append(err) + elif line[0] == "realloc": + errs.remove(line[1]) + errs.append(line[3]) + elif line[1] == "1" and line[3] == "0": + # print line + # print err, errs + assert(err in errs) + errs.remove(err) + +print "leaked:", errs