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
Currently, the initial breakpoint set up when creating a sandbox is set on the entrypoint function, which means that, when creating a sandbox from an initialised snapshot, it is never set up or executed, and a debugger has no easy way to attach.
Relatedly, the debugging infrastructure (and the initial breakpoint) is/are set up in Sandbox::new(), which means that whether a sandbox has a debug thread or not is decided once, at sandbox creation time, but there is also only one place to attach a debugger (at sandbox initialisation time): future function calls, or restored sandboxes, might not be easy to debug, even though they have a debug thread consuming resources.
Note that #1120 might further change debugging due to resetting debug register on snapshot-restores, which could potentially discard breakpoints etc. One possible solution might be to not reset debug registers if gdb cargo feature is enabled?
This is a note to think about the future of debugging a sandbox.
Currently, we rely on the entrypoint function breakpoint to allow the user the time to add new breakpoints, but if a sandbox has been snapshotted after the initialise phase, that won't work.
Additionally we may want to consider that restore/resetting a sandbox might work very differently as we move towards using Snapshots as the basis for creating Sandboxes
Snapshot attach is partly solved. Since Create sandboxes directly from snapshots #1459, HyperlightVm::new sets the one-shot breakpoint at the next entry, so sandboxes from initialised snapshots stop at the first call. restore() does not set it again.
One session per sandbox, fixed at creation, still holds. The gdb thread accepts once. After a detach no client can attach again.
The concern from Reset more vcpu state on snapshot::restore #1120 holds on MSHV and WHP.reset_vcpu zeroes the debug registers, and those hypervisors keep gdb hardware breakpoints there. KVM keeps them in kvm_guest_debug, so they survive.
Sub-issues:
Serve gdb on the vCPU thread #1974: serve gdb on the vCPU thread. This removes the gdb thread and its channels and gives the session a clear owner. A draft passes the existing gdb tests and a new Ctrl-C test.
Activity
ludfjig commentedon Feb 4, 2026
Note that #1120 might further change debugging due to resetting debug register on snapshot-restores, which could potentially discard breakpoints etc. One possible solution might be to not reset debug registers if
gdbcargo feature is enabled?dblnz commentedon Feb 25, 2026
This is a note to think about the future of debugging a sandbox.
Currently, we rely on the
entrypointfunction breakpoint to allow the user the time to add new breakpoints, but if a sandbox has been snapshotted after the initialise phase, that won't work.simongdavies commentedon Feb 25, 2026
Additionally we may want to consider that restore/resetting a sandbox might work very differently as we move towards using Snapshots as the basis for creating Sandboxes
ludfjig commentedon Oct 22, 2026
Status on current main:
HyperlightVm::newsets the one-shot breakpoint at the next entry, so sandboxes from initialised snapshots stop at the first call.restore()does not set it again.reset_vcpuzeroes the debug registers, and those hypervisors keep gdb hardware breakpoints there. KVM keeps them inkvm_guest_debug, so they survive.Sub-issues:
Remaining design question: when should a gdb client be able to attach? Options: