summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/scripts/merge_data_flow.py
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2019-05-08 17:20:09 +0000
committerKostya Serebryany <kcc@google.com>2019-05-08 17:20:09 +0000
commite13eff293db2fa12de11e8087ef62950d0cd8f83 (patch)
tree8bf27fbe7e99d677625d2b732ff948d898382bd7 /compiler-rt/lib/fuzzer/scripts/merge_data_flow.py
parenta0933bd8ec1515167ea653f7ee788b8bbde27d51 (diff)
downloadbcm5719-llvm-e13eff293db2fa12de11e8087ef62950d0cd8f83.tar.gz
bcm5719-llvm-e13eff293db2fa12de11e8087ef62950d0cd8f83.zip
[libFuzzer] DFT: when dumping coverage, also dump the total number of instrumented blocks in a function; update merge_data_flow.py to merge coverage
llvm-svn: 360272
Diffstat (limited to 'compiler-rt/lib/fuzzer/scripts/merge_data_flow.py')
-rwxr-xr-xcompiler-rt/lib/fuzzer/scripts/merge_data_flow.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler-rt/lib/fuzzer/scripts/merge_data_flow.py b/compiler-rt/lib/fuzzer/scripts/merge_data_flow.py
index d6000fa0ed1..9f690182656 100755
--- a/compiler-rt/lib/fuzzer/scripts/merge_data_flow.py
+++ b/compiler-rt/lib/fuzzer/scripts/merge_data_flow.py
@@ -22,20 +22,37 @@ def Merge(a, b):
def main(argv):
D = {}
+ C = {}
+ # read the lines.
for line in fileinput.input():
+ # collect the coverage.
if line.startswith('C'):
+ COV = line.strip().split(' ')
+ F = COV[0];
+ if not F in C:
+ C[F] = {0}
+ for B in COV[1:]:
+ C[F].add(int(B))
continue
+ # collect the data flow trace.
[F,BV] = line.strip().split(' ')
if F in D:
D[F] = Merge(D[F], BV)
else:
D[F] = BV;
+ # print the combined data flow trace.
for F in D.keys():
if isinstance(D[F], str):
value = D[F]
else:
value = D[F].decode('utf-8')
print("%s %s" % (F, value))
+ # print the combined coverage
+ for F in C.keys():
+ print("%s" % F, end="")
+ for B in list(C[F])[1:]:
+ print(" %s" % B, end="")
+ print()
if __name__ == '__main__':
main(sys.argv)
OpenPOWER on IntegriCloud