4.5 KiB
4.5 KiB
| id | ticket | title | status | created | ref_decisions | tags | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0154 | foreground-stack-game-pause-shell-vm-backed | Route Debugger Operations Through VM Sessions | open | 2026-07-05 |
|
|
Briefing
DEC-0038 requires VM-backed mutable execution state to be owned by VM sessions. Normal execution now ticks session-owned VMs, but desktop debugger commands still inspect and mutate firmware.vm, the transitional legacy VM. This leaves debugger state, breakpoints, single-step execution, PC snapshots, and stack snapshots inconsistent with the active VM session.
Objective
Route host debugger operations through the active VM session rather than the legacy firmware VM. Debugger pause/resume/step/state/breakpoint operations must target the same VM context that foreground execution ticks.
Dependencies
- Source decision: DEC-0038.
- Builds on PLN-0148 through PLN-0152.
- Should be implemented before PLN-0155 removes the legacy firmware VM bridge.
Scope
- Add session-aware debugger accessors to
SystemOS/VmFacade. - Expose active VM session inspection and mutation operations needed by the debugger:
- PC;
- operand stack preview;
- insert breakpoint;
- remove breakpoint;
- list breakpoints;
- single-instruction debug step;
- active cartridge identity for handshake and state responses.
- Update
crates/host/prometeu-host-desktop-winit/src/debugger.rsso it no longer reads or mutatesfirmware.vmfor active VM state. - Ensure debugger setup for direct debug boot initializes through normal cartridge/session loading or an explicit session-aware metadata path, not
os.vm().initialize(&mut firmware.vm, ...). - Keep pause/resume/step-frame control mapped to active VM session runtime state.
- Add tests that would fail if debugger state came from the legacy VM while the session VM is active.
Non-Goals
- Do not remove
Firmware.vm; that is PLN-0155. - Do not redesign the debugger protocol.
- Do not add multi-client debugging.
- Do not add background-session debugging beyond active/resident session semantics already supported by DEC-0038.
Execution Method
- Add focused
VmFacademethods for active-session VM inspection:active_pc;active_operand_stack_top;insert_active_breakpoint;remove_active_breakpoint;active_breakpoints_list;debug_step_active_session.
- Define active-session resolution explicitly:
- foreground VM session first;
- resident Game session when Hub has foreground but a resident Game is the active debug target;
- no legacy fallback for debugger mutation once a session exists.
- Update
HostDebugger::setup_boot_targetso debug cartridge metadata is loaded without initializingfirmware.vmas canonical state. - Update
HostDebugger::handle_commandforStep,GetState,SetBreakpoint,ListBreakpoints, andClearBreakpoint. - Update
HostDebugger::stream_eventsbreakpoint-hit PC reporting to read from the active session. - Add tests under
crates/host/prometeu-host-desktop-winit/src/debugger.rsproving debugger commands observe and mutate the session VM. - Run the host, firmware, and system test suites.
Acceptance Criteria
- Debugger handshake reports cartridge identity from session/runtime state or preloaded metadata, not from a global VM initialized only for debugger setup.
GetStatereturns PC and stack data from the active VM session.Stepadvances the active VM session, notfirmware.vm.- Breakpoint commands mutate the active VM session.
- Breakpoint-hit events report the active session PC.
- No debugger command path directly reads or mutates
firmware.vmfor active VM execution state. - Existing debugger protocol tests pass.
Tests
cargo test -p prometeu-host-desktop-winitcargo test -p prometeu-firmwarecargo test -p prometeu-systemcargo clippy -p prometeu-host-desktop-winit -p prometeu-firmware -p prometeu-system --all-targets -- -D warnings- Add tests for:
GetStatereads session VM PC;Stepaffects session VM;- breakpoint insert/list/remove uses session VM;
- debugger setup does not initialize
firmware.vmas the canonical app context.
Affected Artifacts
crates/host/prometeu-host-desktop-winit/src/debugger.rscrates/console/prometeu-system/src/os/facades/vm.rscrates/console/prometeu-system/src/services/vm_session.rscrates/console/prometeu-firmware/src/firmware/firmware.rs- Debugger-related tests in host and firmware crates