Add new script to compare the stack layout (#1112)

* Add new script to debug the stack layout

* fix small error in script

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2024-10-13 23:31:15 +02:00
committed by GitHub
parent 974cd7ce7c
commit 8446a7ffa1
5 changed files with 377 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ from isledecomp.types import SymbolType
from isledecomp.compare.asm import ParseAsm
from isledecomp.compare.asm.fixes import assert_fixup, find_effective_match
from .db import CompareDb, MatchInfo
from .diff import combined_diff
from .diff import combined_diff, CombinedDiffOutput
from .lines import LinesDb
@@ -29,7 +29,7 @@ class DiffReport:
orig_addr: int
recomp_addr: int
name: str
udiff: Optional[List[str]] = None
udiff: Optional[CombinedDiffOutput] = None
ratio: float = 0.0
is_effective_match: bool = False
is_stub: bool = False

View File

@@ -2,7 +2,13 @@ from difflib import SequenceMatcher
from typing import Dict, List, Tuple
CombinedDiffInput = List[Tuple[str, str]]
CombinedDiffOutput = List[Tuple[str, List[Dict[str, Tuple[str, str]]]]]
# from inner to outer:
# Tuple[str, ...]: either (orig_addr, instruction, recomp_addr) or (addr, instruction)
# List[...]: a contiguous block of instructions, all matching or all mismatching
# Dict[...]: either {"both": List[...]} or {"orig": [...], "recomp": [...]}
# Tuple[str, List[...]]: One contiguous part of the diff (without skipping matching code)
# List[...]: The list of all the contiguous diffs of a given function
CombinedDiffOutput = List[Tuple[str, List[Dict[str, List[Tuple[str, ...]]]]]]
def combined_diff(