diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/replace_guids.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/replace_guids.py b/scripts/replace_guids.py new file mode 100644 index 0000000..c2d22ea --- /dev/null +++ b/scripts/replace_guids.py @@ -0,0 +1,34 @@ +from shutil import copyfile + +GUIDS_FILE_PATH = "Build/OvmfX64/DEBUG_GCC5/FV/Guid.xref" +EXTRA_GUIDS_FILE_PATH = "" +LOG_IN_FILE_PATH = "debug.log" +LOG_OUT_FILE_PATH = "debug_parsed.log" + +guids = {} + +with open(GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +if EXTRA_GUIDS_FILE_PATH: + with open(EXTRA_GUIDS_FILE_PATH) as p: + for line in p: + l = line.split(" ") + if len(l)==2: + guids[l[0].upper()] = l[1][:-1] + +copyfile(LOG_IN_FILE_PATH, LOG_OUT_FILE_PATH) + +f = open(LOG_OUT_FILE_PATH, 'r') +filedata = f.read() +f.close() + +for key,val in guids.items(): + filedata = filedata.replace(key, val) + +f = open(LOG_OUT_FILE_PATH, 'w') +f.write(filedata) +f.close() |