havoc-remaster/tools
pyr0ball 7d39ccddf0 fix: harden debug agent for reliable WOW64 watchpoints and multi-run stability
Key fixes applied during Task 6 end-to-end MCP integration testing:

- CONTEXT_ALL (CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS) for Wow64Get/SetThreadContext
  so DR0-DR7 are read and written alongside general-purpose registers
- Native x64 SetThreadContext path in _apply_watchpoints_to_thread: Wow64SetThreadContext
  updates the WOW64 context save area but does not propagate to hardware DR registers;
  the native path is required for hardware watchpoints to actually fire on WOW64 threads
- _REGISTER_NAMES extended to include Dr0-Dr3, Dr6, Dr7 so get_registers returns them
- launch() now terminates and drains the previously attached process before starting a
  new one, preventing stale debug events from a hung game from corrupting a new session
- continue_execution filters events by process ID so late-arriving exit events from a
  previously terminated game do not trigger a false "exited" status for the new process
- AV exception routing restored: EXCEPTION_ACCESS_VIOLATION stops and reports; callers
  skip boot-time AVs in a loop rather than silently continuing them in the agent
- launch_with_breakpoints atomic op in agent server and MCP server
- _DebugWorker dedicated thread: Windows debug API requires all WaitForDebugEvent,
  ContinueDebugEvent, and CreateProcessA calls to originate from the same OS thread;
  ThreadingTCPServer violated this -- replaced with single worker thread + queue
- Gameplay screenshot captured at watchpoint stop (272 KB real frame)

Acceptance checklist results:
- Item 1 PASS: bp@0x40C8E0, eip/eax confirmed
- Item 2 PASS: conditional breakpoint false-skip and true-fire verified
- Item 3 PASS: watchpoint@slot0 fired at 0x40E998 (MOV [DAT_0047c488], EAX in
  player_cooldown_timers_tick -- the DAT write is in the caller, not inside
  compute_frame_delta_ticks_60hz_min1_clamp as the spec assumed)
- Item 4 PASS: screenshot PNG captured (gameplay frame 272 KB)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TN4Ytn3gdWRonNmHpisWQv
2026-07-04 14:05:24 -07:00
..
analyze2.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze3.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze4.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze5.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze6.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze7.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
analyze_crash.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
check_files.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
check_strings.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
createfile_trace.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
dbg_path.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
debug_screenshot_gameplay.png fix: harden debug agent for reliable WOW64 watchpoints and multi-run stability 2026-07-04 14:05:24 -07:00
deep_audit.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
deep_trace.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
drive_trace.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
dump_region.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
ff_extract.py Initial commit: Havoc preservation toolkit + format docs 2026-06-28 23:33:30 -07:00
final_analysis.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_callers.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_cdcheck.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_cdpath.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_drive_func.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_ini_calls.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
find_string.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
full_audit.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
grafix_extract.py feat: crack GRAFIX0N.DAT texture format + extractor 2026-07-03 09:36:41 -07:00
havoc_debug_agent.py fix: harden debug agent for reliable WOW64 watchpoints and multi-run stability 2026-07-04 14:05:24 -07:00
havoc_debug_agent_server.py fix: harden debug agent for reliable WOW64 watchpoints and multi-run stability 2026-07-04 14:05:24 -07:00
havoc_debug_agent_smoke_test.py feat: add hardware watchpoints (DR0-DR3/DR7) and re-armable breakpoints to debug agent 2026-07-04 09:26:37 -07:00
havoc_debug_protocol.py feat: add watchpoint slot/DR7 bookkeeping to MCP protocol module 2026-07-04 06:58:46 -07:00
havoc_mcp_server.py fix: harden debug agent for reliable WOW64 watchpoints and multi-run stability 2026-07-04 14:05:24 -07:00
ini_audit.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
io_audit.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
parse_iat.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
parse_imports.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
patch_exappwindow.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
patch_flagcheck.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
patch_paths.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
patch_vtable.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
path_audit.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
pe_sections.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2ac00.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2alloc.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2alloc2.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2alloc3.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2analyze.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2cdcheck.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2crash.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2heap.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
r2init.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
read_bin_iso.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00
requirements-windows.txt feat: add screenshot capture and local JSON-over-TCP server to debug agent 2026-07-04 09:30:07 -07:00
trace_init.py feat: NOCD patch boots Havoc on modern Windows (defeats CD copy protection) 2026-07-03 09:29:59 -07:00