You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1633b37
Browse filesBrowse the repository at this point in the historyBrowse files
debug_worker: detach the debugger when its session ends
The gdb stub sent DebugRequest::Attach when GDB connected, but never
DebugRequest::Detach, whether GDB detached, its connection dropped, or
the worker stopped or restarted (microsoft/nvx#2094). The partition
went on treating the gone debugger as attached: the session's hardware
breakpoints and single-stepping stayed set on the VPs; the halts that
followed, a power-off, reset, or triple fault included, went to the
debugger instead of the VM's client, so a client set to exit or reset
on them never heard of them; and a paused VM that the debugger held
stayed held until a new session or a clear-halt. The stub's VM proxy
also kept the session's hardware breakpoints, which the next session's
first resume set on the VPs again, unknown to its GDB.
run_state_machine now attaches through a Session guard of the VM proxy,
which sends Detach when it is dropped, so that every end of a session
detaches: GDB's D or k packet and a target exit, which reach
GdbStubStateMachine::Disconnected; an error, which returns early, as a
dropped connection does whether the VM is stopped or running; and the
worker dropping the session as it stops or restarts. The guard also
clears the proxy's breakpoints, stepping, and stop channel. The Guide's
gdbstub page and DebugRequest::Detach say what a detach does; the Guide
also says that GDB's software breakpoints, which it writes into guest
memory, stay there when it loses its connection while the VM runs.
Tests, in the debug worker, which run the stub on a TCP connection,
send GDB's packets, and serve the stub's requests as the partition
does:
- the_debugger_detaches_when_gdb_detaches sends D.
- the_debugger_detaches_when_the_connection_drops closes the connection
while the VM is stopped, and while it runs after a vCont;c.
- the_debugger_detaches_when_the_session_is_dropped drops the session,
as the worker does when it stops or restarts.
- a_session_does_not_set_the_breakpoints_of_the_previous_one sets a
hardware breakpoint with Z1 in a session that then drops, and checks
the debug state that the next session's first resume sets.
On d44a113, on Windows x64, all four fail, since no Detach ends a
session. With the change, they pass, as do the tests of vmm_core and
vmm_core_defs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments