Skip to content

Instantly share code, notes, and snippets.

@SiD3W4y

SiD3W4y/covdiff.py

Created Apr 9, 2019
Embed
What would you like to do?
Script diffing two sets of GBA basic block traces
import sys
def getvals(path):
lines = open(path, "r").readlines()
lst = []
for line in lines:
line = line.strip()
if len(line) >= 10:
addr, cnt = line.split(" ")
lst.append((int(addr, 16), int(cnt)))
resmap = {}
resset = set()
for addr, cnt in lst:
resmap[addr] = cnt
resset.add(addr)
return resset, resmap
if __name__ == '__main__':
if len(sys.argv) < 3:
print("covdiff.py <before.cov...> <after.cov>")
else:
diffset, diffmap = getvals(sys.argv[-1])
for e in sys.argv[1:-1]:
eset, emap = getvals(e)
diffset = diffset - eset
for e in diffset:
print("0x{:08x} {}".format(e, diffmap[e]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.