Skip to content

Instantly share code, notes, and snippets.

@SiD3W4y
Created April 9, 2019 00:47
Show Gist options
  • Select an option

  • Save SiD3W4y/52d4c599dd30b4eb527a05ba24c9c401 to your computer and use it in GitHub Desktop.

Select an option

Save SiD3W4y/52d4c599dd30b4eb527a05ba24c9c401 to your computer and use it in GitHub Desktop.
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]))
@redthing1
Copy link
Copy Markdown

I'm years late, but thank you for your article!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment