Implements DebugAgent class (Task 2) with launch, set/remove breakpoint, get_registers, read/write_memory, continue_execution, and get_status. Handles WOW64 WX86 exception codes (0x4000001F/0x4000001E), keeps debuggee suspended via _pending_event until caller resumes, and tracks stopped thread for correct register reads. Smoke-tested against live HAVOC_NOCD.EXE: stopped at breakpoint@0x40C8E0 with eip=0x40c8e0 confirmed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TN4Ytn3gdWRonNmHpisWQv
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""Manual acceptance smoke tests for the Win32 debug agent. NOT a pytest file -- these
|
|
launch the real HAVOC_NOCD.EXE under the debugger and need a live Windows session.
|
|
|
|
Run from the repo root: python -m tools.havoc_debug_agent_smoke_test
|
|
"""
|
|
|
|
from tools.havoc_debug_agent import DebugAgent
|
|
|
|
GAME = r"Z:\Development\devl\Havoc\HAVOC_NOCD.EXE"
|
|
CWD = r"Z:\Development\devl\Havoc"
|
|
|
|
|
|
def task2_breakpoint_smoke() -> None:
|
|
"""Task 2: breakpoint at busywait_frame_limiter_60hz (0x40C8E0) should trip during the
|
|
boot palette-fade / state transition and report eip == 0x40C8E0."""
|
|
agent = DebugAgent()
|
|
agent.launch(GAME, CWD)
|
|
agent.set_breakpoint(0x40C8E0)
|
|
result = agent.continue_execution(timeout=30)
|
|
print("continue_execution ->", result)
|
|
if result["status"] == "stopped":
|
|
regs = agent.get_registers()
|
|
print("registers ->", {r: hex(v) for r, v in regs.items()})
|
|
assert regs["eip"] == 0x40C8E0, f"expected eip 0x40C8E0, got {regs['eip']:#x}"
|
|
print("TASK 2 SMOKE: PASS")
|
|
else:
|
|
print(f"TASK 2 SMOKE: did not stop at breakpoint (status={result['status']})")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
task2_breakpoint_smoke()
|