1#!/usr/bin/env python3
2
3#this script helps to convert internal debugger scripts given to us into our tools
4
5import sys
6import fileinput
7
8def replace_with_dict(text, dicto):
9	for key, val in dicto.items():
10		text = text.replace(key, val)
11	return text
12
13for lines in fileinput.input([sys.argv[1]], inplace=True):
14	lines = lines.strip()
15	if lines == '': continue # strip empty lines
16	replace_dict = {'dword(' : '../tools/intel_reg_read ', 'MMADDR + ' : '', '//' : '#', ')p;' : '', ')p ' : ' -c '}
17	print(replace_with_dict(lines, replace_dict))
18