-
-
Save redthing1/eb16a042842e880d0c41cbb19819bab3 to your computer and use it in GitHub Desktop.
Script diffing two sets of GBA basic block traces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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