Print recompiled address when using --verbose

This commit is contained in:
Christian Semmler 2023-09-13 10:39:35 -04:00
parent 89f66e4e0e
commit b1a2aeaed6
No known key found for this signature in database
GPG key ID: 086DAA1360BEEE5C

View file

@ -463,11 +463,12 @@ def can_resolve_register_differences(original_asm, new_asm):
else: else:
percenttext += colorama.Fore.RED + "*" + colorama.Style.RESET_ALL percenttext += colorama.Fore.RED + "*" + colorama.Style.RESET_ALL
if not verbose:
if args.print_rec_addr: if args.print_rec_addr:
addrs = '%s / %s' % (hex(addr), hex(recinfo.addr)) addrs = '%s / %s' % (hex(addr), hex(recinfo.addr))
else: else:
addrs = hex(addr) addrs = hex(addr)
if not verbose:
print(' %s (%s) is %s similar to the original' % (recinfo.name, addrs, percenttext)) print(' %s (%s) is %s similar to the original' % (recinfo.name, addrs, percenttext))
function_count += 1 function_count += 1
@ -477,16 +478,16 @@ def can_resolve_register_differences(original_asm, new_asm):
if recinfo.size: if recinfo.size:
udiff = difflib.unified_diff(origasm, recompasm, n=10) udiff = difflib.unified_diff(origasm, recompasm, n=10)
# If verbose, print the diff for that funciton to the output # If verbose, print the diff for that function to the output
if verbose: if verbose:
if effective_ratio == 1.0: if effective_ratio == 1.0:
ok_text = "OK!" if plain else (colorama.Fore.GREEN + "✨ OK! ✨" + colorama.Style.RESET_ALL) ok_text = "OK!" if plain else (colorama.Fore.GREEN + "✨ OK! ✨" + colorama.Style.RESET_ALL)
if ratio == 1.0: if ratio == 1.0:
print("%s: %s 100%% match.\n\n%s\n\n" % print("%s: %s 100%% match.\n\n%s\n\n" %
(hex(addr), recinfo.name, ok_text)) (addrs, recinfo.name, ok_text))
else: else:
print("%s: %s Effective 100%% match. (Differs in register allocation only)\n\n%s (still differs in register allocation)\n\n" % print("%s: %s Effective 100%% match. (Differs in register allocation only)\n\n%s (still differs in register allocation)\n\n" %
(hex(addr), recinfo.name, ok_text)) (addrs, recinfo.name, ok_text))
else: else:
for line in udiff: for line in udiff:
if line.startswith("++") or line.startswith("@@") or line.startswith("--"): if line.startswith("++") or line.startswith("@@") or line.startswith("--"):