feat(runtime): report where a title stops and break into an attached debugger #65
No reviewers
Labels
No labels
accessibility
bug
ci
docs
documentation
duplicate
enhancement
fixes issue
good first issue
help wanted
invalid
library request
libs
needs rebase
question
relinker
stale
tools
unblocks title
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Dark3581--AnyBox!65
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/65/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Dark3581 on GitHub · 2026-11-23 01:48 UTC · original
Dark3581:feat/bringup-debugging→main· +249 −8 · 9 files · 1 commits · merged 2026-11-23 01:51 UTCWhat
Debugging support for the first runs of a real executable. A stop now says where in the title it was reached, and a debugger can be attached at the right moment:
Backtraces in the run report and the log.
AbxNotImplementedandAbxUnsupportedcapture up to 32 frames of the stopping thread. A crash unwinds the faulting context with the modules' unwind tables (frames without unwind data are read as leaves, bounded by the thread's stack). The report'sstopgains:frames: each frame's module, offset and address;caller: the first frame outside AnyBox'sab_*modules and the Windows directory, which is the title's call site, or null when the title is not on the stack (for example on an AnyBox worker thread).The relinker leaves the title's sections in place, so the caller's offset is the same RVA in the original executable to open in Ghidra or IDA.
The log gets
called from title.exe+0x…orcrashed in …and the numbered frames. Therun_report_summary.pyline ends with(called from module+offset).Debugger break: with a debugger attached, a stop breaks into it after writing the report and before the process exits, so the title's state at the call can be inspected.
ANYBOX_BREAK=0turns it off.ANYBOX_WAIT_DEBUGGER=<seconds>: logs the process ID, waits for a debugger to attach, and breaks before the title's entry point. This is for titles that a launcher starts.The schema gains
callerandframesas optional fields, so existing reports stay valid at version 1.docs/dev/GAME_TESTING.mdgets a "Debugging a stop" section (how to go from a caller offset to the call in a disassembler, plus the environment variables), and the README links to it.Tested
Windows 10, MinGW (GCC) and MSVC 2022.
calleristitle.exe+0x…, the first frame is inab_xgameruntime.dll, and the log has thecalled fromline;calleris null and the frames are present;title.exeand matchesexception.offset.e2e_stub_debugger: starts the relinked title withANYBOX_WAIT_DEBUGGER, attaches a minimal debugger (DebugActiveProcess) once the waiting line appears, and checks the start-up break and the break at the stop. Exit code is still0xAB01. It passed 8 repeats. A manual run withANYBOX_BREAK=0gets only the start-up and attach breaks, andANYBOX_WAIT_DEBUGGER=1without a debugger continues after the wait.ctest: 73 of 73. With MSVC the stub, crash, device, worker and debugger e2e tests pass, and every target builds exceptab_gameinput, which needsgameinput.lib, which this machine doesn't have.python tools/check_conventions.pyanddebt_fold.py --check: ok.Example log line from the stub scenario:
[anybox] called from title.exe+0x31013.Checklist
main; no other open PR implements the same functionspython tools/check_conventions.pypasses (no comments in code, one declaration per export, Conventional Commit subjects)AbxNotImplemented/AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragmentdocs/dev/debt/changes/<branch>.mdRtlCaptureStackBackTrace,RtlLookupFunctionEntry,RtlVirtualUnwind,IsDebuggerPresent,DebugActiveProcess)