Skip to content

Instantly share code, notes, and snippets.

Created Apr 9, 2019
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
return resset, resmap
if __name__ == '__main__':
if len(sys.argv) < 3:
print(" <before.cov...> <after.cov>")
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