aboutsummaryrefslogtreecommitdiffstats
path: root/.auto/diff_spans.py
diff options
context:
space:
mode:
Diffstat (limited to '.auto/diff_spans.py')
-rw-r--r--.auto/diff_spans.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/.auto/diff_spans.py b/.auto/diff_spans.py
index 95721a5..aad4ebc 100644
--- a/.auto/diff_spans.py
+++ b/.auto/diff_spans.py
@@ -39,11 +39,11 @@ def load_impl(path: str, name: str):
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod) # IDA-free at import time
body = mod.BODY
- a = body.index("#: IDA colour tag -> the semantic kind")
- b = body.index("def _idatui_unknown_row")
+ a = body.index("def _idatui_head_row")
+ b = body.index("def _idatui_struct_member_rows")
g = {"__name__": name}
exec(compile(body[a:b], name, "exec"), g) # noqa: S102
- return g["_idatui_spans"]
+ return g
def main() -> int:
@@ -59,8 +59,10 @@ def main() -> int:
fh.write(subprocess.run(
["git", "-C", ROOT, "show", f"{a.ref}:server/patch_server.py"],
capture_output=True, text=True, check=True).stdout)
- new = load_impl(os.path.join(ROOT, "server", "patch_server.py"), "new")
- old = load_impl(old_path, "old")
+ gnew = load_impl(os.path.join(ROOT, "server", "patch_server.py"), "new")
+ gold = load_impl(old_path, "old")
+ new, old = gnew["_idatui_spans"], gold["_idatui_spans"]
+ new_row, old_row = gnew["_idatui_head_row"], gold["_idatui_head_row"]
binary = os.path.join(ROOT, a.target)
tgt = os.path.join(d, os.path.basename(binary))
@@ -89,7 +91,15 @@ def main() -> int:
if ra != rb:
bad += 1
if bad <= 3:
- print(f"MISMATCH @ {ea:#x}\n line={line!r}\n"
+ print(f"SPAN MISMATCH @ {ea:#x}\n line={line!r}\n"
+ f" old={ra!r}\n new={rb!r}")
+ # The whole row, not just the spans: `text`, the spans/text
+ # agreement guard and the name all moved around too.
+ ra, rb = old_row(ea), new_row(ea)
+ if ra != rb:
+ bad += 1
+ if bad <= 3:
+ print(f"ROW MISMATCH @ {ea:#x}\n"
f" old={ra!r}\n new={rb!r}")
nxt = ida_bytes.get_item_end(ea)
ea = nxt if nxt > ea else ea + 1