# 18 — Live metaprogram debugger state and control Status: PLANNED; no implementation claim Requirements: R-016,R-017,R-019,R-021 Dependencies: 09,10,12, successful17; shared sessions with19-21. ## Ownership and boundaries Proposed Astra: NEW include/vls/debug/session/, src/debug/session/, tests/debug/session/. Root owns state-machine/control DTOs. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository. ## Contracts and data flow Launch binds a frozen translation-unit/context snapshot and selected real evaluation/source/instantiation. States preparing/running/stopped/completed/failed/cancelled/expired are explicit. DAP alone controls execution; custom queries are read-only. Inspection handles include session/snapshot/stop generation and expire on movement. ## Implementation sequence 1. Validate launch/context completeness, admit one live compiler session per server instance and establish memory/process enforcement before execution. Missing explicit template arguments are not guessed. 2. Implement source/event breakpoints, pause/continue and step-in/over/out at documented supported boundaries, with logical frames/scopes/typed values mapped to source snapshots. 3. On source edits mark session outdated; require restart to adopt changes. Serialize control actions and bind asynchronous inspections to the current stop generation. 4. Enforce2GiB worker/3GiB aggregate debug memory,60s running CPU,120s running wall watchdog,30min paused idle and5s disconnect cleanup. Limits are configurable; count paused memory and reap descendants. ## Failure behavior and constraints Reject launch when enforcement or source/context prerequisites are absent. Timeout/resource excess/cancellation preserves only committed trace data with explicit status. An intentional stop is not a stuck-worker timeout. Read-only inspection excludes arbitrary state-changing evaluation/set-variable; live reverse execution is not claimed. ## Acceptance scenarios 1. Exercise breakpoints and all stepping modes through nested template/constexpr/reflection calls, plus pending breakpoint resolution and failed constraints. 2. Continue while old variable queries are in flight and reject stale handles/replies; edit source and verify frozen-session behavior. 3. Test paused-session saturation, RSS/CPU/wall limits, zero-CPU hangs, disconnect/leader-exit descendants and foreground LSP latency during debug. ## Verification and integration Proposed NEW CTest label: `live-debug`. Once implemented, register a nonzero suite and run: ```sh dev cpp-gcc -c ctest --test-dir build/bootstrap -L live-debug --output-on-failure ``` This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Cancel/reap sessions before backend/control protocol changes. Do not silently resume a paused target or reuse stale handles. Preserve recoverable trace prefixes separately from live compiler state.