aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/debug
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-10-16 14:30:02 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2017-10-16 14:42:55 -0700
commit58b2d85a21b60a6961ae83459a70e664080e4a54 (patch)
treef770e53b78837be90b913c89c34bd8bd5b02cb6e /tools/debug
parent4979ce5f9341ff72c5974bd86e101016438660f0 (diff)
Checking in tools
Diffstat (limited to 'tools/debug')
-rw-r--r--tools/debug/core/error_ref_leak.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/debug/core/error_ref_leak.py b/tools/debug/core/error_ref_leak.py
new file mode 100644
index 0000000000..99f986a97b
--- /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