-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerialStatusLoopRemoval.py
More file actions
45 lines (40 loc) · 1.61 KB
/
SerialStatusLoopRemoval.py
File metadata and controls
45 lines (40 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This script remove the loop of waiting for a character on the serial
# This is useful to speed the replay up
import sys
#from SearchMemoryEntries import touches_any
from TraceEntries import *
#ranges=[0x16000000]
#
#size = 0x1000
if __name__ == "__main__":
tf = TraceFile(sys.argv[1])
# use this function for compression
of = open_file(sys.argv[2], 'wb')
last_entry = None
l = 0
for h, p in tf.generate_elements():
#print(hex(h._data['type']))
if h._data['type'] == ExecutionTraceType.TRACE_MEMORY:
addr = p._data['address']
if addr == 0x16000018 and \
p._data['value'] == 0x90 and \
not (p._data['flags'] & ExecutionTraceMemory.EXECTRACE_MEM_WRITE) and \
int(h._data['timeStamp']) >= 449836202137180 and \
int(h._data['timeStamp']) <= 449836204765388:
#l >= 300 * 1024 * 1024:
#if True:
curr_entry = (p._data['pc'], p._data['address'], p._data['value'])
if last_entry is None:
last_entry = curr_entry
elif last_entry == curr_entry:
#print("skip")
continue
last_entry = curr_entry
d = 'W' if ExecutionTraceMemory.EXECTRACE_MEM_WRITE & p._data['flags'] else 'R'
print("[%c]: @0x%0x [0x%08x] -> 0x%08x" % \
(d, p._data['pc'], addr, p._data['value']))
s = h.dumps()+p.dumps()
l += len(s)
of.write(s)
#print("%d" % int(h._data['timeStamp']))
of.close()