3 Commits

Author SHA1 Message Date
alex b8645312eb Merge branch 'develop' of https://git.minres.com/TGFS/TGC-ISS into develop 2023-06-05 15:22:31 +02:00
alex e6e3dc3f13 updates submodules 2023-06-05 15:20:28 +02:00
alex cac68ac8c2 adds helperscript for easier debugging 2023-06-05 15:19:58 +02:00
4 changed files with 31 additions and 3 deletions
+3 -1
View File
@@ -8,4 +8,6 @@
/analysis_results /analysis_results
.vscode .vscode
*.log *.log
tcc_jit*.c *tcc_jit*.c
*.disass
*.trc
+26
View File
@@ -0,0 +1,26 @@
import re
import os
'''
This script takes all files that get dumped by the tcc backend when using the --dump-ir
option and replaces the Integers of addresses with their hex representation to allow
for easier debugging.
'''
current_dir = os.getcwd() # Get the current directory
files_with_tcc_jit = [file for file in os.listdir(current_dir) if"jit" in file and not file.startswith("readable")]
for each in files_with_tcc_jit:
readable_file = f"readable_{each}"
if os.path.exists(readable_file):
os.remove(readable_file)
with open(each, "r") as file:
content = file.read()
for each in files_with_tcc_jit:
with open(each, "r") as file:
content = file.read()
# Replace numbers ending with "U" by their hex representation
content = re.sub(r'\b(\d+)U\b(?=U)?', lambda m: hex(int(m.group(1))), content)
with open(f"readable_{each}", "w") as file:
file.write(content)