Skip to content

gdb: snapshot restore breaks breakpoints #1972

Open

Description

@ludfjig
  • 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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions