aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/debug
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-12-11 18:09:31 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-12-11 18:10:00 -0800
commit5f8bf79bbf4915b928f75c83c66592b1fa97657e (patch)
tree38753ccc2a25774e87c27cd0af185e3d7c8cbe0a /tools/debug
parent888093c6ed0d24eed699173b5fb35235fe7a6069 (diff)
yapf tools
Diffstat (limited to 'tools/debug')
-rwxr-xr-xtools/debug/core/chttp2_ref_leak.py22
-rw-r--r--tools/debug/core/error_ref_leak.py34
2 files changed, 29 insertions, 27 deletions
diff --git a/tools/debug/core/chttp2_ref_leak.py b/tools/debug/core/chttp2_ref_leak.py
index d693dd9e54..a6a5448775 100755
--- a/tools/debug/core/chttp2_ref_leak.py
+++ b/tools/debug/core/chttp2_ref_leak.py
@@ -20,8 +20,10 @@ import collections
import sys
import re
+
def new_obj():
- return ['destroy']
+ return ['destroy']
+
outstanding = collections.defaultdict(new_obj)
@@ -29,14 +31,14 @@ outstanding = collections.defaultdict(new_obj)
# chttp2:unref:0x629000005200 2->1 destroy [src/core/ext/transport/chttp2/transport/chttp2_transport.c:599]
for line in sys.stdin:
- m = re.search(r'chttp2:( ref|unref):0x([a-fA-F0-9]+) [^ ]+ ([^[]+) \[(.*)\]', line)
- if m:
- if m.group(1) == ' ref':
- outstanding[m.group(2)].append(m.group(3))
- else:
- outstanding[m.group(2)].remove(m.group(3))
+ m = re.search(
+ r'chttp2:( ref|unref):0x([a-fA-F0-9]+) [^ ]+ ([^[]+) \[(.*)\]', line)
+ if m:
+ if m.group(1) == ' ref':
+ outstanding[m.group(2)].append(m.group(3))
+ else:
+ outstanding[m.group(2)].remove(m.group(3))
for obj, remaining in outstanding.items():
- if remaining:
- print 'LEAKED: %s %r' % (obj, remaining)
-
+ if remaining:
+ print 'LEAKED: %s %r' % (obj, remaining)
diff --git a/tools/debug/core/error_ref_leak.py b/tools/debug/core/error_ref_leak.py
index 6582328a5b..7806338683 100644
--- a/tools/debug/core/error_ref_leak.py
+++ b/tools/debug/core/error_ref_leak.py
@@ -26,22 +26,22 @@ data = sys.stdin.readlines()
errs = []
for line in data:
- # if we care about the line
- if re.search(r'error.cc', line):
- # str manip to cut off left part of log 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])
- # explicitly look for the last dereference
- elif line[1] == "1" and line[3] == "0":
- assert(err in errs)
- errs.remove(err)
+ # if we care about the line
+ if re.search(r'error.cc', line):
+ # str manip to cut off left part of log 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])
+ # explicitly look for the last dereference
+ elif line[1] == "1" and line[3] == "0":
+ assert (err in errs)
+ errs.remove(err)
print "leaked:", errs