diff options
Diffstat (limited to 'compiler-rt/lib/fuzzer/scripts/merge_data_flow.py')
-rwxr-xr-x | compiler-rt/lib/fuzzer/scripts/merge_data_flow.py | 17 |
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) |