Files
Matt Graham ac10ac0e5f tools: tools.diff compares oracle and recomp checkpoint traces
Reports the first register or memory divergence for a bounded guest case.
The Unicorn oracle is an optional, lazily imported dependency.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 22:47:38 +00:00

17 lines
709 B
Python

from .case import Case
from .compare import first_divergence, format_divergence
def main():
case = Case({"name": "selfcheck", "code": "90", "entry_eip": 0x1000,
"stop": {"instructions": 1},
"state": {name: 0 for name in ("eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", "eflags")},
"memory": [], "calls": []}).validate()
assert case.data["name"] == "selfcheck"
divergence = first_divergence([{"eip": 0x1000, "eax": 1}], [{"eip": 0x1000, "eax": 2}])
assert divergence and divergence.reason == "eax"
assert "FIRST DIVERGENCE" in format_divergence(divergence)
print("diff selfcheck: PASS")
if __name__ == "__main__":
main()