summaryrefslogtreecommitdiff
path: root/scripts/convert_itp.py
blob: 4474f34d130d71d67eb3c97f9cac07d1a2e23834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3

#this script helps to convert internal debugger scripts given to us into our tools

import sys
import fileinput

def replace_with_dict(text, dicto):
	for key, val in dicto.items():
		text = text.replace(key, val)
	return text

for lines in fileinput.input([sys.argv[1]], inplace=True):
	lines = lines.strip()
	if lines == '': continue # strip empty lines
	replace_dict = {'dword(' : '../tools/intel_reg_read ', 'MMADDR + ' : '', '//' : '#', ')p;' : '', ')p ' : ' -c '}
	print(replace_with_dict(lines, replace_dict))