-
Notifications
You must be signed in to change notification settings - Fork 858
Expand file tree
/
Copy pathpatch.py
More file actions
35 lines (29 loc) · 1.38 KB
/
patch.py
File metadata and controls
35 lines (29 loc) · 1.38 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
with open("src/wasm-interpreter.h") as f:
content = f.read()
# Add debug prints to doAtomicLoad and doAtomicStore
load_hook = """ Literal doAtomicLoad(Address addr,
Index bytes,
Type type,
Name memoryName,
Address memorySize,
MemoryOrder order) {
std::cerr << "doAtomicLoad addr=" << addr << " memoryName=" << memoryName << " instance=" << this << "\\n";"""
content = content.replace(""" Literal doAtomicLoad(Address addr,
Index bytes,
Type type,
Name memoryName,
Address memorySize,
MemoryOrder order) {""", load_hook)
store_hook = """ void doAtomicStore(Address addr,
Index bytes,
Literal toStore,
Name memoryName,
Address memorySize) {
std::cerr << "doAtomicStore addr=" << addr << " val=" << toStore << " memoryName=" << memoryName << " instance=" << this << "\\n";"""
content = content.replace(""" void doAtomicStore(Address addr,
Index bytes,
Literal toStore,
Name memoryName,
Address memorySize) {""", store_hook)
with open("src/wasm-interpreter.h", "w") as f:
f.write(content)