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
Hardware breakpoints are lost on MSHV and WHP. Those backends store gdb hardware breakpoints in the guest's DR0-DR7 (mshv/x86_64.rs#L853, whp/x86_64.rs#L1181). reset_vcpu zeroes those registers (x86_64.rs#L327). gdb still lists the breakpoints. KVM keeps them in kvm_guest_debug, so they survive there.
Software breakpoints are written into snapshot memory. gdb builds make snapshot memory writable for this (build.rs#L162).
snapshot() captures the 0xCC bytes. After restore nothing tracks them.
restore() can remove a breakpoint that sw_breakpoints still lists. Removing it later writes the saved byte over whatever the restored snapshot holds at that address.
Possible fix: keep breakpoint state on the host and apply it again after restore(). Take software breakpoints out before snapshot().
Might it be better to send a notification that the target terminated (and maybe restarted) on snapshot restore? There is a pretty good likelihood that we are looking at a totally different binary after a restore, so blindly re-applying the breakpoints in use on the previous one seems a bit odd? I am also not sure whether there is anything that the client will potentially be caching that could be rewritten e.g. the list of dynamically loaded objects.
The biggest argument against that is that maybe taking a snapshot is now itself also implicitly restoring the snapshot in order to make sure that future snapshots are taken against the correct layer tree. It does kind of make sense that you should be able to preserve GDB state across a snapshot operation, even if not a restore one.
Activity
syntactically commentedon Nov 16, 2026
Might it be better to send a notification that the target terminated (and maybe restarted) on snapshot restore? There is a pretty good likelihood that we are looking at a totally different binary after a restore, so blindly re-applying the breakpoints in use on the previous one seems a bit odd? I am also not sure whether there is anything that the client will potentially be caching that could be rewritten e.g. the list of dynamically loaded objects.
The biggest argument against that is that maybe taking a snapshot is now itself also implicitly restoring the snapshot in order to make sure that future snapshots are taken against the correct layer tree. It does kind of make sense that you should be able to preserve GDB state across a snapshot operation, even if not a restore one.